Steady state file

I am a new user of Dynare. I tried to enter my model’s steady state ratios to jpfeifer’s code but is gives me the error of unknown variables. Is there any specific method for writing steady state equations ??? I guess I should write them in this way:

  • For each endogenous variable, there should be one equation.
  • At the left hand side, we should just have one endogenous variable, not a ratio.
    -The first endogenous variable should be completely defined by parameters.
    -For the second endogenous variable, we can use parameters and first endogenous variable but we cannot use any new endogenous variable that is not defined earlier by parameters, because Matlab gives you the error for unknown variable.
    Am I right?

[quote=“gbel”]Thanks Johannes,

Sorry for the late reply (paternity leave).

I’m resubmiting the file with your correction.

Gilles[/quote]

Hi,
thanks for the steady state file. Can I use it to calculate my model’s steady state? Should I change some codes in the files? There are 102 equations and 102 variables in my model.
I have been working with the model for one month, but I cannot get the right steady state by hand. I appreciate that you share your code here. Thank again and I hope for a further help from you. thanks!!!

cindy

The code posted here only delivers one of the two formats required to enter a manual steady state into Dynare. You still need to compute the steady state by pencil and paper in order to be able to enter it. If you don’t want to set parameters in your steady state or use a numerical solver (e.g. you reduced your system to a nonlinear equation in labor, solve this equation using fsolve and then compute the other variables), everything that the steady state file does, can also be provided in the initval-block.

Thank you for your reply.
I tried and I get the steady state by pencil.
Thanks again.
Best regards.

cindy

Dear jpfeifer,

I tried to use your code to create steady state file. But I got an error;

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.1).
Starting preprocessing of the model file …
Found 19 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.
    Warning: Some of the parameters have no value (rstar, sd, yss, kss, k_over_ghss,
    hss) when using steady. If these parameters are not initialized in a steadystate
    file, Dynare may not be able to solve the model…

In test_for_deep_parameters_calibration at 46
In steady at 33
In uribefinanssfile at 226
In dynare at 120
Undefined function or variable ‘M_’.

Error in uribefinanssfile_steadystate (line 11)
if isfield(M_,‘param_nbr’) == 1

Error in evaluate_steady_state_file (line 49)
[ys,check] = h_steadystate(ys_init, exo_ss);

Error in evaluate_steady_state (line 58)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, …

Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in uribefinanssfile (line 226)
steady;

Error in dynare (line 120)
evalin(‘base’,fname) ;

I attached my codes. Could you help me ? Thanks…
uribefinanssfile_steadystate.m (3.11 KB)
uribefinanssfile.mod (5.76 KB)

The error message comes because you deleted the space between M_ and lgy_ in the global variable definition. Next, you should never name parameters alpha, beta, gamma because these are the names of Matlab functions. Use e.g. alphha, betta, gammma instead. If you do this, you will see that your analytical steady state is wrong. See the attached files.
uribefinanssfile_steadystate.m (3.12 KB)
uribefinanssfile.mod (5.79 KB)

Thank you very much for your reply. I made correction in my code. It helps.
One more question. When I run the code making estimation, it gives this result;

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.1).
Starting preprocessing of the model file …
Found 23 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : -7.9604
Equation number 7 : -7.9604
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 7.9604
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : 0
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : 0
Equation number 22 : 0
Equation number 23 : 0

Error using print_info (line 55)
The steadystate file did not compute the steady state

Error in resid (line 116)
print_info(info,options_.noprint)

Error in steady (line 90)
resid;

Error in uribefinansestson (line 291)
steady;

Error in dynare (line 120)
evalin(‘base’,fname) ;

Thanks again.

As I wrote, your steady state computation is wrong. There still is a residual in equations 6,7, and 10.

Thank you for your reply. But i dont understand that when i run the model without steady state file, resid(1) gives for all equations zero. It gives this result.

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.1).
Starting preprocessing of the model file …
Found 23 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.

STEADY-STATE RESULTS:

c 0.150095
h 0.179761
lamda 275.756
a 1
g 1.01
k 0.292417
d 0.007
i 0.0396226
r 0.105919
y 0.211472
k_over_gh 1.61059
v 1
s 0.0211472
mu 1
gy 1.01
gc 1.01
gi 1.01
tb 0.000607129
tby 0.00287096
gy_obs 1.01
gc_obs 1.01
gi_obs 1.01
tby_obs 0.00287096

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : 0
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : 0
Equation number 22 : 0
Equation number 23 : 0

Loading 105 observations from arj_data.m

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached
Error in computing likelihood for initial parameter values
Error using print_info (line 57)
Impossible to find the steady state. Either the model doesn’t have a unique
steady state of the guess values are too far from the solution

Error in initial_estimation_checks (line 69)
print_info(info, DynareOptions.noprint)

Error in dynare_estimation_1 (line 147)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);

Error in dynare_estimation (line 70)
dynare_estimation_1(var_list,dname);

Error in uribefinansestson (line 328)
dynare_estimation(var_list_);

Error in dynare (line 120)
evalin(‘base’,fname) ;

But with the steady state file, it gives errors for equations 6,7 and 10 and residuals of the static equations are different from zero? What is the reason behind this? May it stem from MCMC algorithm which uses different initial point for each draw? In simulation part, it works with steady state file. I really appreciate all answers. Thanks.

Seems to me you put resid(1) after steady, not before. If you use steady, Dynare numerically computes the steady state before you check for residuals.

Thank you very much for your reply. I wrote resid(1) after steady command as you said. But when I wrote it after initval block and before steady command, nothing changed. At least, simulation gives no error. But with steady state file, it gives the same error. There may be sth wrong with steady state file or not. Thanks…

Hello,

You know, there is file which corresponds steady state file in the models folder under UserGuide of dynare. The file is called fs2000ns steadystate.m. May I use this file by just changing equations and parameters to create my own steady state file ? Does using this file have any advantage or disadvantage compared to using previously stated dog_steady state file?
Thanks…

I write steady-state by modifying fs2000steady state file. In simulation part, it works. In estimation part, excluding gd as an estimated parameter, it works and calculates steady-state of the model. but when including gd as an estimated parameter it fails and gives this error

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.1).
Starting preprocessing of the model file …
Found 23 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.

STEADY-STATE RESULTS:

c 0.150095
h 0.179761
lamda 275.756
a 1
g 1.01
k 0.292417
d 0.007
i 0.0396226
r 0.105919
y 0.211472
k_over_gh 1.61059
v 1
s 0.0211472
mu 1
gy 1.01
gc 1.01
gi 1.01
tb 0.000607129
tby 0.00287096
gy_obs 0.00995033
gc_obs 0.00995033
gi_obs 0.00995033
tby_obs 0.00287096

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : 0
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : 0
Equation number 22 : 0
Equation number 23 : 0

Loading 105 observations from arj_data.m

Error in computing likelihood for initial parameter values
Error using print_info (line 55)
The steadystate file did not compute the steady state

Error in initial_estimation_checks (line 69)
print_info(info, DynareOptions.noprint)

Error in dynare_estimation_1 (line 147)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);

Error in dynare_estimation (line 70)
dynare_estimation_1(var_list,dname);

Error in uribefinansestson (line 315)
dynare_estimation(var_list_);

Error in dynare (line 120)
evalin(‘base’,fname) ;

Parameter gd enters almost all equations for ss values of endogenous parameters and also enter equation of parameter rstar
rstar = ((1/betta)*(gd^(gammma)))-1;
In finding the posterior mode, Dynare recalculates the steady state of the model at each iteration of the optimization routine based on the newest round of parameters available. rstar is written before check=0 command in ss file. In that case, does rstar take new values for each value of gd or not? If it does not, how can I overcome this problem?

Hi All,

Say we have computed the steady-state values of the endogenous variables of the model. I just want to assign these values and take the 2nd-order approximation of the model without using steady command or another m-file which compute the steady-state of the model (i.e. dog_steadystate). I just want to use an M-file with the values for the endogenous variables.

How can i do this in Dynare?

Thanks in advance,

P.

Hi All,

I suppose you can use
initval; end; commands without using the steady command. In this way, the approximation is around the steady-state given between initval; … end;.

Is this correct?

P.

You don’t need the steady command after initval. It mostly provides diagnostics. Note however, that the steady state computation performed within steady is always conducted during the stoch_simul-command.

Dear jpfeifer,

Thanks for your reply.

If i don’t use the steady command. The approximation will be around the steady-state given between
initval; … end;?

P.

Not exactly. stoch_simul will always search for a steady state. If your initial values already describe a steady state, this one is taken and nothing needs to be done. If the initial values do not exactly describe a steady state, Dynare will use a solver to find one given your initial values.

This also implies that you cannot fool Dynare to compute an approximation around a given point that is not a steady state by using your described approach.

Thanks.

I use a steady-state, between initval; …end;
The problem is that i use some rules, like a Taylor rule, which their feedback coefficients should affect only transition and not the steady-state.
However, when i use dynare to find the steady-state the feedback coefficient affects , even sligthly, the steady-state values of the model.

P.

I don’t understand how that can be. If you provide actual analytical steady state values, this should not happen. The feedback parameters may only affect the steady state due to numerical issues when you provide inaccurate values and Dynare uses a root finder. But even then, if the model has a unique steady state, the steady state should be same when you use a small enough convergence criterion. If you suspect a problem with Dynare, please send me the mod-file.