Unable to estimate DSGE parameters-singularity

I am trying to do ML estimation of a DSGE model with two observables and two sectoral shocks. One of the shocks is to a unit root process, one to a stationary process. I get the message
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.

The parameter estimates come back close to the initial values with NaN standard deviations and t-statistics. Also the smoothed shock to the stationary process has a slight trend. The model solves and I can do stochastic simulations just fine, but (as I have limited experience with estimation in Dynare) it seems like I must be making some basic error in trying to estimate parameters. Any ideas? I’ve attached the code and data file. Thanks.
investmentGE_Oct2021_hfac_UR_ML.mod (4.0 KB)
cidata59.xlsx (13.8 KB)

Two issues stand out:

  1. You are not correctly handling parameter dependence. When estimating gamu, you cannot independently set
gc=(1+gamu)^.33-1;

Use e.g. model-local variables for that.
2. Use mode_check to see that your estimation gets stuck at the upper bound for the standard errors. That explains the subsequent crash.

Thanks, I had seen that warning about dependent parameters in the video that you had linked in another thread, but hadn’t noticed that it was an issue for my code. I was able to get the estimation to work with those changes, but only after increasing the bounds on the shock standard errors (which I could see was an issue from the mode_check output, as you had suggested). Appreciate the help!.

Now I’ve tried to apply the same approach to a different .mod file, and I’m getting the error

Error using print_info (line 32)
Impossible to find the steady state (the sum of square residuals of the static equations is 60.9408).
Either the model doesn’t have a steady state, there are an infinity of steady states, or the guess
values are too far from the solution

This is even though when I just solve the model with fixed parameters and do stoch_simul it finds the steady state and does the irfs just fine. So there must be some kind of syntax error. The file that gets the error is attached, along with the data file. Thanks in advance.
investmentGE_Nov2021_UR_simpS4_ML.mod (7.4 KB)
cidata59.xlsx (13.8 KB)

There are really big residuals and the `steady´ before estimation does not work.

It still seems to be a problem with the way I introduce local variables. Here are two versions of the code. In the one ending 2tr, I fix the parameter eta, so C1,C2,D1,D2 are also fixed, and I can solve the model and estimate parameters with Maximum Likelihood (for a range of different values of eta, and the likelihood varied smoothly with the choice of eta).
investmentGE_Nov2021_UR_simpS4_2tr.mod (7.7 KB)
. In the one ending ML2, I try to estimate eta, which C1,C2,D1, and D2 depend on, so I make them local variables. I use the same other parameter values and initial values, but get the “Impossible to find the steady state” error message. So there must be some problem with how I am coding this. Thanks.
investmentGE_Nov2021_UR_simpS4_ML2.mod (7.7 KB)
cidata59.xlsx (13.8 KB)

I see. Clearly

C1 = (del1+gu)^(1/eta); C2 = (del2+gu)^(1/eta);
D1 = (del1+gu)/(1-eta); D2 = (del2+gu)/(1-eta);

shows that those two are not independent parameters. When you estimate eta, these two will not reflect the true value of eta, but will rather remain at the value that was assigned. So having them as model-local variables is the correct way to proceed. The problem you are facing is that properly updating the dependent objects changes the model by more than when keeping the dependent values fixed. As a consequence, the initval will be poor starting values for the model with different values for eta than the initial one.

Thanks, so is it a matter of trying different initial values, or is it just intractable? One thing I tried was to fix the C and D as parameters for some eta, estimate eta, then reset C and D using the new eta, estimate eta again, iterate, and hope it would converge. Unfortunately it didn’t converge.

Another strange thing that happens sometimes when I change initial values or parameters even slightly is that I get an error “ERROR: trends not compatible with balanced growth path; the second-order cross partial of equation 22 (line 68) w.r.t. trend variable Bu and endogenous variable Omegauprime is not null (abs. value = 520.612). If you are confident that your trends are correctly specified, you can raise the value of option ‘balanced_growth_test_tol’ in the ‘model’ block.” I tried changing that setting but it didn’t help.

  1. You should try to analytically compute the steady state. Everything else is very error prone. A fixed point for C and D will not exist, because eta will be estimated later on.
  2. Could you provide me with a file to replicate the trend issue?

Hi, ok will try to fix the steady state issue analytically.
In the attached file, the model solves fine with gamu = 0.01 (line 33). If I change it to gamu=0.011, for example, I get that error. I’ve also gotten that error from changing initial values (even to those I think are closer to the steady state). gamu is the growth rate parameter of one of the two stochastic trends in the model.
investmentGE_Oct2021_hfac_UR_ML1.mod (4.2 KB)

Your growth factor specification

  gu=exp(gamu+w);
  gd=exp(gamd+u);

is incorrect. It must be

  gu=1+gamu+w;
  gd=1+gamd+u;

if the ratio of e.g. iu/iu(-1) in steady state is supposed to be 1+gamu.

Ah, ok, that makes sense. I guess I got away with it for small values of gamu, but it mattered when the values got larger. Thanks.