would it be possible for some of you to generously take a look at my confusion about dynare?
After running dynare mod (for example dynrbc.mod)file, it automatically generates a m_file named dynrbc_dynamic.m.
the function shows up at the top of this file is “function [residual, g1, g2, g3] = dynrbc_dynamic(y, x, params, steady_state, it_)”
Therefore I have some question about variables: y x steady_state it_.
lets say, the original four endogenous variables are c i k a, two exogenous variables are u v. And the M_.lead_lag_incidence=[1 0 0 2;3 4 5 6;0 7 0 8].
Does this mean?
y=[c(+1) a(+1) c i k a i(-1) k(-1)] which contains 8 variables now,
steady_state=[c_ss a_ss c_ss i_ss k_ss a_ss i_ss k_ss];
it_=1; (this is always true).
if this is the case, what is the format of y and x that preserved in dynare? y and x should be string or cell or some other format? it is column vector or row vector?
And why do we need it_ here? is it necessary?
As the manual says
computing the Jacobian of the dynamic model, the order of the endogenous variables
in the columns is stored in M_.lead_lag_incidence. The rows of this matrix
represent time periods: the first row denotes a lagged (time t-1) variable, the second
row a contemporaneous (time t) variable, and the third row a leaded (time t+1)
variable. The colums of the matrix represent the endogenous variables in their order
of declaration. A zero in the matrix means that this endogenous does not appear
in the model in this time period. The value in the M_.lead_lag_incidence matrix
corresponds to the column of that variable in the Jacobian of the dynamic model.
Example: Let the second declared variable be c and the (3,2) entry of M_.lead_
lag_incidence be 15. Then the 15th column of the Jacobian is the derivative with
respect to y(+1).[/quote]
In your example, the first entry (element (1,1)) of M_.lead_lag_incidence corresponds to the lag of the first declared variable. That would be consumption c. M_.lead_lag_incidence says that c(-1) is the first element of y (and not c(+1) as you wrote).
y is a column vector, while x is a [nperiods by M_.exo_nbr] double (note the typo in the header of dynamic files in 4.4.2 that confused the dimensions) storing the value of the ith declared exogenous variable in period j in element x(j,i). The it is needed to select the time period for which the derivatives are computed. It is mostly needed for determinstic simulation where the entries of x are not simply 0.
I hope this helps.
Thanks a lot! jpfeifer, now I see where my problem is, I misunderstood some notions, and thanks again for your help!