Declaration order

Dear all,
Is there a way to find the ordering of variable name to find its steady state value?

I am interested in finding steady state of variable “mort”
I cannot write oo_.dr.ys(mort), oo_.dr.order_var(mort).

Variables in “oo_.dr.ys” are in static, backward, mixed, forward variables ordering.
Should I think that whatever value gives me from oo_.dr.order_var(3) is the ordering of what I declared in my var names in mod file?

Is there a way to find “oo_.dr.order_var(mort)” then I put this into “oo_.dr.ys” to find the steady state value?

Thanks,
Amina

No, steady states are in declaration order. Try

oo_.dr.ys(strmatch('mort',M_.endo_names,'exact'))

Thanks a lot!

How do we go the reverse? For example

oo_.dr.ys(strmatch(‘mort’,M_.endo_names,‘exact’))

gives the steady state value for ‘mort’

what if I am interested in the order of this value?

M_.endo_names(‘mort’)

: gives 3 cell arrays, while

M_.endo_names(32)

gives ‘mort’. I am interested in getting 32. I see in lecture notes that people manually write mort = 32, then use

oo .dr.ghx(oo .dr.inv_order_var(mort,:))

You would do

mort_pos=strmatch('mort',M_.endo_names,'exact');
oo .dr.ghx(oo .dr.inv_order_var(mort_pos,:))
1 Like

Thank you!

Hello Johannes, thanks for your reply. I have two more questions:

  1. M_.endo_names(M_.state_var) provides names of state variables. How do we get names of non-state variables? The following approach is incorrect:

B=M_.endo_names;
B(M_.nstatic +1:M_.nstatic + M_.npred+M_.nboth)=[];
mort_pos = strmatch(‘mort’,B,‘exact’);

  1. Would ordering of gx_ match M_.endo_names(M_.state_var) where gx_ is

gx_ = oo_.dr.ghx(M_.nstatic +1:M_.nstatic + M_.npred+M_.nboth,:);?

What exactly are you trying to achieve? It’s easiest to extract this info from M_.lead_lag_incidence. See line 213ff of matlab/model_info.m · master · Dynare / dynare · GitLab

I divided my variables into state and control and wanted to find positions of each variables within state/control variables

I actually solved my problem, thank you very much!