Long leads

I have code with long leads of some variables (40 leads!).
I’m having trouble computing the steady state for auxiliary variables created by dynare because of my long leads.
I have two questions.
The auxiliary variables appear to be of two types: leads and lags.
An example of a lag variable is: AUX_ENDO_LAG_16_12
The first number after the delimiter, _, probably refers to a variable in the var command. The second variable probably refers to lag.
Question #1: Does the number 16 in this case refer to the 16th variable in the var command? Or, is it perhaps the 17th variable? We have some evidence that it may be the latter.
An example of the other type of auxiliary variable, a lead, is AUX_ENDO_LEAD_7243
Question #2: Is there a way to map from the number 7243 into a variable in the var list?

Hi Larry

[quote=“larry”]I have code with long leads of some variables (40 leads!).
The auxiliary variables appear to be of two types: leads and lags.
An example of a lag variable is: AUX_ENDO_LAG_16_12
The first number after the delimiter, _, probably refers to a variable in the var command. The second variable probably refers to lag.
Question #1: Does the number 16 in this case refer to the 16th variable in the var command? Or, is it perhaps the 17th variable? We have some evidence that it may be the latter.
[/quote]

This is right the numbering of variables in this case starts with 0. This is confusing, but would be probably even more confusing to change it now… Note that
M_.aux_vars(i).endo_index contains the correct index starting at 1.

[quote]
An example of the other type of auxiliary variable, a lead, is AUX_ENDO_LEAD_7243
Question #2: Is there a way to map from the number 7243 into a variable in the var list?[/quote]

No there is no way, because these auxiliary variables stand in general for a nonlinear expression containing variables with leads, not necessarily a single variable.

You are probably trying to write a _steadystate.m model by hand. We have recently introduced a steady_state_model block where you can enter the recursive solution for the steady state. Then the _steadystate.m file is written automatically, taking care of the auxiliary variables. This produces also a more efficient version to the _steadystate.m file.

However, using a nonlinear solver to solve only a subset of the equations of the model is not yet supported. This could be the occasion to add the feature.

If you still need to write your own _steadystate.m file, we have added to the unstable version of Dynare, a function _set_auxiliary_variables.m that computes the value of the auxiliary variables given the value of the main endogenous ones.

Don’t hesitate to contact me on my personal email to disccuss ways to improve Dynare in that regard.

All the best,

Michel