Hello,
I just would like to check two things regarding the implementation of the Expectation operator:
1) Where should I check that arg1 is numeric in "EXPECTATION(arg1)(arg2)": during parsing, within the checkPass(), or during the transformPass() while dealing with the expectation operator?
2) I also want to make sure that, after creating auxiliary variables for every instance of oExpectation, I should erase the associated BinaryOpNode.
This should be done in the next couple of days.
Thanks, Houtan
2009/9/30 Sébastien Villemot sebastien.villemot@ens.fr
Hi all,
I have made an important change in the preprocessor, which should fix an important bug that Michel has discovered. It turns out that Dynare gives a wrong result for stochastic approximation at order 2 for models with leads of 2 or more.
In order to fix that bug, the preprocessor now removes all leads and lags >=2 for a stochastic model. It does so by creating auxiliary variables and equations, so that the model has only one lead and one lag. This is the strategy used by Dynare++, and it is the easiest way to fix that bug.
So don't be surprised if Dynare reports more equations than you declared, and if some variables called "AUXLEAD..." and "AUXLAG..." appear. You can examine the result of the transformation by using the "write_latex_dynamic_model" command (see http://www.dynare.org/DynareWiki/ModelLatexOutput )
The bug should now be fixed (although I now have a crash on GIMF in dr1.m). What remains to be done is the adaptation of the output routines, so that the output remains the same than before (instead of having the auxiliary variables in it).
Houtan: for the auxiliary variables related to the expectation operator, you can reuse the framework that I have setup.
- in SymbolTable.hh, add a new enum to aux_var_t, a new method for
adding your type of aux var, and if needed new fields to AuxVarInfo
- add a new method to class DynamicModel (similar to those for
substituting leads and lags)
- call that new method from ModFile::transformPass(), *before* the
methods substituting leads and lags
- for the initialization of new aux variables (since they are not
declared in the "initval" block, the preprocessor needs to give an initial value to them): you need to add your new auxiliary equations to ModelTree::aux_equations; this should suffice, the mechanism that I have setup in DynamicModel::fillEvalContext() and StaticModel::writeAuxInitval() should take care of it
Best,
-- Sébastien Villemot
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev