Problem with estimating on empirical data


I’m having some troubles with estimating a baseline version of the RBC-model i Dynare on empirical data (i.e. “baseline_data” file).
Can someone please help me why Dynare failure to calculate the estimated model?

Thanks for taking your time.

romer_estimation.mod (1.2 KB)
Baseline_data.xlsx (12.1 KB)

Before moving to estimation, make sure you can simulate the model. For example, I am pretty sure the timing of capital in

c = w*lab+(r+1-cdelta)*k - k(-1);

is wrong.

I can simulate the model with no problems :slight_smile:

How? model_diagnostics complains about k not being present at time t.

The estimation is based on these simulations rbc_romer.mod (1.0 KB)

How about rbc_romer.mod (1.0 KB) ?
Your model has output going down after a positive TFP shock…

Thanks for your input - the results changes especially the impulse response functions. Hence i still have implications with estimation on empirical data

Do you still have the steady_state_model-block in your mod-file?

Above i estimated the model with the “steady” command and no “steady_state_model-blok”. Hence I tried again with the steady_state_model-blok where i obtain this

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

romer_estimation.mod (1.6 KB)

Use romer_estimation.mod (1.6 KB)
steady will not work without proper initial values. Now your data treatment looks wrong. See Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”

As I have 8 observable variables should I then declare 8 shocks?
romer_estimation_new.mod (1.6 KB)

If you really want 8 observables, you need at least 8 shocks. You may still get a problem with stochastic singularity if you don’t have some measurement error. All of that is detailed in the guide linked above.

Yes that was also my thoughts - thank for providing me feedback, I really appreciate your help.
I have now declared 2 observable variables and 2 shocks where some of the estimation process succeed but I estimate a negative matrix <0 .

“Error using chol
Matrix must be positive definite.”

How is it possible to correct for this? I tried to look at your guide but with no success.
romer_estim_old.mod (1.6 KB)

The data file is missing.

sorry for the many questions but i don’t understand how the data file can be missing when i have declared the data file in the estimation-block and the program are able to estimate part of the code?

Thanks for taking your time to help me!

romer_estim_old.mod (1.6 KB)

What error message do you get? Note that programming languages are case-sensitive. Your Excel-file starts with a capital letter.


  • (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.
    *Warning: The results below are most likely wrong! *
    > In dynare_estimation_1 (line 315)
  • In dynare_estimation (line 105)*
  • In romer_estim_old.driver (line 247)*
  • In dynare (line 293) *


Fval obtained by the minimization routine (minus the posterior/likelihood)): 13.409097
Warning: Matrix is singular, close to singular or badly scaled. Results may be
*inaccurate. RCOND = NaN. *
> In dynare_estimation_1 (line 338)

  • In dynare_estimation (line 105)*
  • In romer_estim_old.driver (line 247)*
  • In dynare (line 293)*

Log data density [Laplace approximation] is NaN.

Error using chol
Matrix must be positive definite.

Error in posterior_sampler_initialization (line 84)
d = chol(vv);

Error in posterior_sampler (line 60)

  • posterior_sampler_initialization(TargetFun, xparam1, vv,*
  • mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);*

Error in dynare_estimation_1 (line 465)

  •        posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);*

Error in dynare_estimation (line 105)

  • dynare_estimation_1(var_list,dname);*

Error in romer_estim_old.driver (line 247)

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

I’m trying to estimate the model with more than one observable variables (y_obs and c_obs) - when i estimate with only y_obs i receive no error messages so i think it could be in the definition of the additional shock variable/equation where it goes wrong.


Please provide the most recent mod-file and data-file

romer_estim_old.mod (1.6 KB)

baseline_romer.m (1.4 KB)


I am not sure what you are doing.

  1. The uploaded file does not run, because there is a log missing in
log(cA) = rhov*(cA(-1))+epsv;
  1. The parameter rhov is clearly not identified as you are neither observing cA nor is cA affecting any other part of the model.