Hi Houtan,
> Dear Michel and Sébastien,
>
> Everything is coded and tested for the svar_identification. However, I
> want to check my implementation of the maximum lag length (r) with
> you. In order to obtain r, I have introduced a temporary variable
> entitled max_endo_lag in ParsingDriver, which updates this variable
> every time add_model_variable() is called. Is this the best way to do
> this or can you think of a better way. I should point out that it is
> my understanding that the variables entitled like max_endo_lag in
> DynamicModel do not actually contain the original maximum endogenous
> lag in the model (which is what I understand should be the value for
> r). Otherwise, I would have simply included dynamic_model in the
> SvarIdentificationStatement class.
>
this is true. (S)VAR will be the only type of models that are left with
lags on more than one period.
> One problem with the implementation I have chosen is that we would
> need to ensure that the model block is declared before the
> svar_identification block in the .mod file. I noticed that, currently,
> though in the manual we are instructed as to the proper declaration
> order within the .mod file (i.e. vars, params, model, ...,
> estimation/stoch_simul), this order is not enforced within Dynare.
> In fact, certain mixes of this ordering work (e.g. putting the initval
> statement above the model block) whereas certain orderings fail
> without any sort of descriptive message (e.g., ... shock block,
> initval block, model block ...). In my opinion, enforcing some sort of
> ordering and exiting with a warning to the user would be nicer than
> simply allowing dynare to crash.
>
> So, if the implementation described in paragraph 1 that obtains the
> maximum endogenous variable lag length by constantly updating this
> variable in add_model_variable is correct, we must ensure that the
> model block has been declared before the svar_identification block so
> that this variable will have been set. That said, I welcome any ideas
> that would solve this problem more efficiently than the method
> described herein.
They are in fact very few strict order dependencies that need to be
enforced and checked. The manual gives more an advice than an obligation.
For, (S)VAR, we don't need the model block and we need to relax this
requirement in the preprocessor.
In this particular case, I don't think that we need to enforce any
consistency. It makes sense for example to declare identification
restrictions on many lags and then decide to estimate with a smaller
number of lags in the VAR, without asking the user to adjust the
SVAR_IDENTIFICATION block.
You probably need to create an SvarIdentificationStatement class similar
to i.e. InitParamStatement in NumericalInitialization.hh
that record all the identification restrictions before the output stage.
You can declare there a private variable with the maximum number of lags
used in the svar_identification block.
Sebastien, what do you think?
Best
Michel
You need however the maximum number of lags used in the
SVAR_IDENTIFICATION block to dimension Ri