# Simulate Estimation Of A Simple 3-eq Model

Hi all,

I am new to Dynare, still having a hard time reading manual and other people’s codes. Forgive me if the question is super basic.

My goal: I am thinking about writing a Dynare file to both simulate and then estimate the same simple DSGE model, see if the parameter values vary at all (consistent with the identification results).
I have a specific setup attached here, and some calibrated values to the parameters. I would love to generate the observables with this set of parameters and then estimate the model as if I don’t know the parameters.

My question: 1. I don’t know what command to use to generate y_t, pi_t, and i_t and then save it in a data file. I guess stoch_simul will do the simulation, but can I save the result and use it in the same mod file?
2. I wrote the estimation part with some data file I found online just as an exercise. However, the results are weird even if identification test passed.
POSTERIOR KERNEL OPTIMIZATION PROBLEM!

• (minus) the hessian matrix at the “mode” is not positive definite!*
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
1. Another thing I’m really curious about is even when people claim they are doing estimation, they have this calibration block. Why do we need that if the parameter priors are already set by the estimated_params block?

Data1.m (7.3 KB)
three_eq_nk.mod (1020 Bytes)

Thank you!

Check the manual. Simulated variables are already saved.

Because you need to solve the model…thus making sure BK conditions are satisfied before estimating the parameters. If BK conditions are not satisfied, the estimation will not work either.

Thank you, Emmanuel. The way I understand it, the BK condition only matters when solving a Linear Rational Expectation model? Are you saying the calibration values give the initial value of parameters that are used to check the BK condition? If there is an indeterminacy issue, will estimation go?

Yes, the model must work in a calibrated version before you estimate it. It is your choice to use the parameters in the `parameters;` block as initial values for the estimation, or you can change it.

The parameters you specify in the `parameters;` block are not necessarily initial values for the estimation.

No, it won’t. The model must be solved first. If there is no solution, then you cannot estimate it.

Thanks again, Emmanuel. I guess indeed I am a little confused by the seemingly similar block names.
Correct me if I am wrong.
The calibrated parameter; block is used to first solve the model, but not used any further.
The parameters; block is used to declare params, but I can also initialize their values in that block?
And the estimated_params; is where I put prior distributions for estimation.

What if there’s a conflict between second and third block? which initial value would then be used? A random draw from prior or the parameters; block?
And in addition, even if a solution exists, when an indeterminacy issue exists (non-uniqueness), I guess you are saying Dynare would not give me the continuum of equilibria?

Yes. If you want to use those parameters as initial values for estimation, you must use the command `use_calibration;`…see manual.

Yes, prior distribution and initial values of parameters for estimation…see manual.

Initial values for estimation are specified in `estimated_params;` block. If you want to use calibrated parameters as initial values, you must specify `use_calibration;`.

Dynare will only give you unique solution if one exist.

I see. If I am to use stoch_simul(irf=60) y r pi, then it generates the response data from a one-time shock. That is not what I want. How could I generate a simulated data as in I would like to have different realizations of shocks each period as if the y, r, pi are from some realized shock process? Is `stoch_simul(order=1,periods=1000,simul_replic=1);` what I want?
Also, do you know how to call `oo_.endo_simul` variable from the simulated result in the `estimation` command?
`periods=x` will get you simulated series that will also be stored under the names of the variables in the workspace. You can then use `datatomfile` as in line 229 of examples/Ramsey_Example.mod · master · Dynare / dynare · GitLab