Can Dynare estimate this SSM model?

Dear professors,

I am a beginner in the study of New Keynesian models. I recently discovered this tool (Dynare) and I am trying to use it along with Octave.

I would like to know if Dynare is capable of estimating coefficients and unobservable variables present in the semi-structural model presented in the link below:

ri202112b7p.pdf (bcb.gov.br)

Unfortunately, the text is in Portuguese. The idea is that the model consists of 5 equations containing observable variables, unobservable variables, and coefficients. The author claims to estimate the coefficients and unobservable variables using Bayesian methods and the Kalman filter. Before you ask, I cannot contact the author. He does not respond to me.

I am going in circles. Could someone help me?

Is there any Dynare and semi-structural model course for beginners?

Are there any courses on how to build Bayesian algorithms and Kalman filters?

Thank you in advance for any assistance you can provide.

Best regards

1 Like

Yes, Dynare does Bayesian estimation with a Kalman filter. See e.g.

Thank you very much, professor, it helped a lot.

I saw on the Dynare website that there are summer courses about the package. I live in Latin America. Could I be a student in the course? If yes, how can I register?

Unfortunately, the deadline for the Dynare summer school has already passed.

I am trying to simulate a semi-structural model proposed by the IMF. The parameters are fixed (they have already been estimated - I just copied them) and I tried to find suitable initial values to solve it. When I run the model in Dynare on Octave, the following error appears:

DYNARE_SOLVE (solve_algo=2|4): the Dulmage-Mendelsohn decomposition returned a non-square block. This means that the Jacobian is s
ingular. You may want to try another value for solve_algo.
error: Impossible to find the steady state (the sum of squared residuals of the static equations is 2.2661). Either the model does
n’t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution
error: called from
print_info at line 33 column 5
stoch_simul at line 119 column 5
driver at line 1022 column 27
dynare at line 310 column 5

I am a beginner in this area. I can’t find my mistake. Could someone help me?

The content of the .mod file is as follows:

var L_GDP
    L_GDP_GAP
    L_GDP_BAR
    DLA_GDP_BAR
    MCI
    L_CPI
    DLA_CPI
    E_DLA_CPI
    D4L_CPI
    D4L_CPI_TAR
    RMC
    RS
    RSNEUTRAL
    RR
    RR_GAP
    RR_BAR
    L_S
    PREM
    L_Z
    L_Z_GAP
    L_Z_BAR
    DLA_Z_BAR
    L_GDP_RW_GAP
    RS_RW
    RR_RW_BAR
    L_CPI_RW
    DLA_CPI_RW
    ;

varexo SHK_L_GDP_GAP
       SHK_DLA_CPI 
       SHK_L_S 
       SHK_RS 
       SHK_RR_BAR 
       SHK_DLA_Z_BAR 
       SHK_DLA_GDP_BAR
       SHK_D4L_CPI_TAR
       SHK_L_GDP_RW_GAP 
       SHK_RS_RW 
       SHK_DLA_CPI_RW 
       SHK_RR_RW_BAR
       ;


parameters b1
           b2
           b3
           b4
           a1
           a2
           a3
           e1
           g1 
           g2
           g3
           rho_D4L_CPI_TAR
           rho_DLA_Z_BAR 
           rho_RR_BAR
           rho_DLA_GDP_BAR
           rho_L_GDP_RW_GAP
           rho_RS_RW 
           rho_DLA_CPI_RW
           rho_RR_RW_BAR
           ss_D4L_CPI_TAR
           ss_DLA_Z_BAR
           ss_RR_BAR 
           ss_DLA_GDP_BAR
           ss_DLA_CPI_RW 
           ss_RR_RW_BAR
           ;


b1 = 0.8;
b2 = 0.3;
b3 = 0.5;
b4 = 0.7;
a1 = 0.7;
a2 = 0.2;
a3 = 0.7;
e1 = 0.4;
g1 = 0.7;
g2 = 0.5;
g3 = 0.5;
rho_D4L_CPI_TAR = 0.5;
rho_DLA_Z_BAR = 0.8;
rho_RR_BAR = 0.8;
rho_DLA_GDP_BAR = 0.8;
rho_L_GDP_RW_GAP = 0.8;
rho_RS_RW = 0.8;
rho_DLA_CPI_RW = 0.8;
rho_RR_RW_BAR = 0.8;
ss_D4L_CPI_TAR = 2;
ss_DLA_Z_BAR = -1.5;
ss_RR_BAR = 0.5;
ss_DLA_GDP_BAR = 2.5;
ss_DLA_CPI_RW = 2;
ss_RR_RW_BAR = 0.75;


model;
L_GDP_GAP = b1*L_GDP_GAP(-1) - b2*MCI + b3*L_GDP_RW_GAP + SHK_L_GDP_GAP;
MCI = b4*RR_GAP + (1-b4)*(-L_Z_GAP);
DLA_CPI =  a1*DLA_CPI(-1) + (1-a1)*DLA_CPI(+1) + a2*RMC + SHK_DLA_CPI;
RMC = a3*L_GDP_GAP + (1-a3)*L_Z_GAP;
E_DLA_CPI = DLA_CPI(+1);
RS = g1*RS(-1) + (1-g1)*(RSNEUTRAL + g2*(D4L_CPI(+4) - D4L_CPI_TAR(+4)) + g3*L_GDP_GAP) + SHK_RS;
RSNEUTRAL = RR_BAR + D4L_CPI(+1);
L_S = (1-e1)*L_S(+1) + e1*(L_S(-1) + 2/4*(D4L_CPI_TAR - ss_DLA_CPI_RW + DLA_Z_BAR)) + (-RS + RS_RW + PREM)/4 + SHK_L_S;
RR  = RS - D4L_CPI(+1);
L_Z = L_S + L_CPI_RW - L_CPI;
L_CPI 	= L_CPI(-1) + DLA_CPI/4;
L_Z_BAR = L_Z_BAR(-1) + DLA_Z_BAR/4;
D4L_CPI = L_CPI - L_CPI(-4);
L_GDP_BAR = L_GDP_BAR(-1) + DLA_GDP_BAR/4;
L_GDP 	= L_GDP_GAP + L_GDP_BAR;
RR 	= RR_BAR + RR_GAP; 
L_Z 	= L_Z_GAP + L_Z_BAR; 
DLA_GDP_BAR = rho_DLA_GDP_BAR*DLA_GDP_BAR(-1) + (1-rho_DLA_GDP_BAR)*ss_DLA_GDP_BAR + SHK_DLA_GDP_BAR;
D4L_CPI_TAR = rho_D4L_CPI_TAR*D4L_CPI_TAR(-1) + (1-rho_D4L_CPI_TAR)*ss_D4L_CPI_TAR + SHK_D4L_CPI_TAR;
DLA_Z_BAR   = rho_DLA_Z_BAR*DLA_Z_BAR(-1) + (1-rho_DLA_Z_BAR)*ss_DLA_Z_BAR + SHK_DLA_Z_BAR;
RR_BAR      = rho_RR_BAR*RR_BAR(-1) + (1-rho_RR_BAR)*ss_RR_BAR + SHK_RR_BAR;
DLA_Z_BAR(+1) = RR_BAR - RR_RW_BAR - PREM;
L_GDP_RW_GAP = rho_L_GDP_RW_GAP*L_GDP_RW_GAP(-1) + SHK_L_GDP_RW_GAP;
RS_RW        = rho_RS_RW*RS_RW(-1) + (1-rho_RS_RW)*(RR_RW_BAR + DLA_CPI_RW) + SHK_RS_RW;
DLA_CPI_RW   = rho_DLA_CPI_RW*DLA_CPI_RW(-1) + (1-rho_DLA_CPI_RW)*ss_DLA_CPI_RW + SHK_DLA_CPI_RW;
RR_RW_BAR    = rho_RR_RW_BAR*RR_RW_BAR(-1) + (1-rho_RR_RW_BAR)*ss_RR_RW_BAR + SHK_RR_RW_BAR;
L_CPI_RW     = L_CPI_RW(-1) + DLA_CPI_RW/4; 
end;


initval;

    L_GDP = 0;
    L_GDP_GAP = 0;
    L_GDP_BAR = ss_DLA_GDP_BAR/4;
    DLA_GDP_BAR = ss_DLA_GDP_BAR;
    DLA_CPI = 0;
    L_CPI = 0;
    D4L_CPI_TAR = ss_D4L_CPI_TAR;
    RR = ss_RR_BAR;
    RS = ss_RR_BAR;
    D4L_CPI = 0;
    RR_GAP = 0;
    RR_BAR = ss_RR_BAR;
    L_S = e1*(2/4*(ss_D4L_CPI_TAR - ss_DLA_CPI_RW + ss_DLA_Z_BAR)) + (-ss_RR_BAR + (1-rho_RS_RW)*(ss_RR_RW_BAR + ss_DLA_CPI_RW) + ss_RR_BAR - ss_RR_RW_BAR - ss_DLA_Z_BAR)/4;
    L_Z = e1*(2/4*(ss_D4L_CPI_TAR - ss_DLA_CPI_RW + ss_DLA_Z_BAR)) + (-ss_RR_BAR + (1-rho_RS_RW)*(ss_RR_RW_BAR + ss_DLA_CPI_RW) + ss_RR_BAR - ss_RR_RW_BAR - ss_DLA_Z_BAR)/4 + ss_DLA_CPI_RW/4;
    L_Z_GAP = 0;
    L_Z_BAR = ss_DLA_Z_BAR/4;
    L_Z = ss_DLA_Z_BAR/4; 
    PREM = ss_RR_BAR - ss_RR_RW_BAR - ss_DLA_Z_BAR;
    DLA_Z_BAR = ss_DLA_Z_BAR;
    RS_RW = (1-rho_RS_RW)*(ss_RR_RW_BAR + ss_DLA_CPI_RW);
    L_GDP_RW_GAP = 0;
    RR_RW_BAR = ss_RR_RW_BAR;
    DLA_CPI_RW = ss_DLA_CPI_RW;
    MCI = 0;
    RMC = 0;
    E_DLA_CPI = 0;
    RSNEUTRAL = ss_RR_BAR;
    D4L_CPI = 0;
    L_CPI_RW = ss_DLA_CPI_RW/4;
end;





shocks;
var SHK_L_GDP_GAP; stderr 1;
var SHK_DLA_CPI; stderr 1; 
var SHK_L_S; stderr 1; 
var SHK_RS; stderr 1; 
var SHK_RR_BAR; stderr 1; 
var SHK_DLA_Z_BAR; stderr 1; 
var SHK_DLA_GDP_BAR; stderr 1;
var SHK_D4L_CPI_TAR; stderr 1;
var SHK_L_GDP_RW_GAP; stderr 1; 
var SHK_RS_RW; stderr 1; 
var SHK_DLA_CPI_RW; stderr 1; 
var SHK_RR_RW_BAR; stderr 1;
end;


stoch_simul(order=1,irf=20) L_CPI;

It seems your model has one or more unit roots. In that case, there are infinitely many steady states and they cannot be endogenously computed. Please provide an analytical steady state.

Thank you very much, professor, for the response. You are helping me a lot to understand this new world I am studying. In order to better understand the subject, could you please provide me with an example of a model with one or more unit root that contains the mathematical expressions of the analytical steady state?

Equations like

look like a unit root with drift. If DLA_CPI=0, any value for L_CPI would be a steady state. If DLA_CPI is different from 0, no steady state will exist.

Could you achieve good results, @adhrneto ?
I can recognize this model as the one developed by IMF Institute for Capacity Development.
The equation cited by @jpfeifer is, in fact, a simple definition. As a newbie in Dynare, it seems at least curious to me, as other software (Eviews and Iris) can handle them.

@rrremedio Usually Dynare can handle this. e.g.

and

But as a user, you need to know what you are doing.

1 Like