Convergence diagnostics problem

Dear Jpfeofer:

Thanks for your help.

As for using the mh_mode file as the mode_file for a new estimation run, I set in the estimation command as following:

Am I right?

Regards,

Correct

Dear Jpfeifer:

Unfortunately, when I set the command as above, I got the error message as following:

Reference to non-existent field ‘parameter_names’.

Error in dynare_estimation_init (line 202)
if isequal(mode_file.parameter_names, bayestopt_.name)

Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_, bayestopt_);

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

Error in code (line 1044)
dynare_estimation(var_list_);

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

But if I set mode_file = code_mode, mode_compute = 6,

The code can run. I am confused about which one is correct. Can you help me with this problem?

Unfortunately, this is another detected bug with a proposed but not yet implemented bugfix. For now, you could change the file that creates the mh_mode file according to:
github.com/JohannesPfeifer/dynare/commit/7f15295cda5093e3d29ef8178bf81acf51e1dbb4

Dear Jpfeifer,

Thanks for your answer.

Since I am not good at program coding, I am not able to change the file that creates the mh_mode file according to your suggestion. Can you explain the method in a bit more detail? Does it need to code in Matlab command window directly?

Besides, I tried to set mode_file = code_mode, mode_compute = 6, and run my program, I found that the convergence improved a lot. Is this result reliable?

I am looking forward to your relpy.

Regards,

Running mode_compute=6 again is similar to what I suggested. If it works, just proceed with this.

Dear Jpfeifer,

Thanks for your help. And I notice that in the dynare manual, it is said that loan_mh_file is to tell dynare to add to previous MH simulations instead of starting from scratch. Does this command have the same meaning as your suggestion?

Regards,

No. The difference is the starting point and the Hessian used. See [Usage of load_mh_file)

Dear Pfeifer,

Thanks for your help.

Although I have fixed the convergence problem, the impulse response functions’ graphs seem weird. The impulse response seems to fluctuate up and down around the some values, for example, zero, rather than to smooth back to the steady state. Is this result reliable? If not, what’s the problem and how to fix it?

Here attached one of the impulse response graphs.

I am looking forward to your reply.

Regards,
code_Bayesian_IRF_epsd_b_1.pdf (14.5 KB)

Your estimate implies a complex eigenvalue, leading to oscillatory behavior. These type of oscillations are very uncommon in economics, so something is most problabyl still wrong. Unfortunately, it is impossible to tell what. Anything that affects your estimation results from wrong equations (for example wrong timing in feedback equations) to non-convergence can lead to this issue.

Dear Pfeifer,

Thanks for your help.

As for the complex eigenvalue, I guess it may be related to the mode file. Because before I use the mode file of last estimation round as the mode file for a new estimation run, the impulse response is normal, even though the convergence problem remains unsolved. But when I fixed the convergence problem, the impulse response became weird. So do you have any idea about it?

Besides, as for the model, the household faces a collateral constraint, as other literature does which contains a durable goods sector or housing sector. However, I did not include the collateral constraint or borrowing constraint as a log-linearized equation in the model block. I just combined the collateral constraint with other first order conditions together to get a equation, which equates the marginal utility of non-durable consumption to the shadow value of durable services. But I found that Iacoviello&Neri (2010) and Funke&Paetz(2013) use the collateral constraint as a separate equation in their code. Is there any problem with what I have done?

Thanks.

Regards,

It might be that you have converged to a local maximum of the likelihood, which is not the true one. This would explain the behavior. In this case, use a calibrated version of your model with the most recent mode and find out which parameter causes the problem.

I am not familiar with those papers so I cannot answer your question. But when in doubt, try to follow the literature and see whether that solves your problem.

Dear Pfeifer,

Thanks for your help.

Do you mean I should use the most recent posterior mode as the calibrated parameter values and do not run the estimation ? Why not the posterior mean?

Regards,

I am just saying you should try to find out which estimated parameter is responsible for the oscillations. And you are correct: the posterior mean should be better as it is used for the IRFs.

Dear Jpfeifer,

Thanks for your help.

However, I found another problem.

When I run my code for the first time, the identification analysis told me that All parameters are identified in the model (rank of H) as well as All parameters are identified by J moments (rank of J). But when I use the mh_mode file as the mode_file for a new estimation run for the second or third time, the identification analysis are shown as:

All parameters are identified in the model (rank of H).

WARNING !!!
The rank of J (moments) is deficient!

What’s the problem? And how to fix it?

Regards,

This means that at least one of the parameters (or a linear combination) is estimated in a way that it plays no role for the moments anymore.

Dear Jpfeifer,

Thanks for your help.

Q1, Is it possible to know which parameters are responsible for the deficiency in the rank of J (moments)? How can I fix this problem? I am still confused about why this problem did not show up in my first run. Could you tell me why?

Q2, Besides, I also found that when I add one more observable and everything else remains the same, and when I run my code for the third round to get better convergence as well, dynare got stuck ans showed as below:

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file …
Substitution of endo lags >= 2: added 39 auxiliary variables and equations.
Found 95 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
  • order 2
  • derivatives of Jacobian/Hessian w.r. to parameters
    Computing dynamic model derivatives:
  • order 1
  • order 2
  • derivatives of Jacobian/Hessian w.r. to parameters
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.

EIGENVALUES:
Modulus Real Imaginary

           0                0                0
           0                0                0
           0                0                0
           0               -0                0
  5.313e-140      -5.313e-140                0
  2.653e-136      -2.653e-136                0
  6.723e-102       6.723e-102                0
  1.669e-101       1.669e-101                0
   4.56e-100       -4.56e-100                0
   1.342e-73        1.342e-73                0
   2.696e-70       -2.696e-70                0
    2.69e-66        -2.69e-66                0
   2.808e-64        2.808e-64                0
   7.297e-48        7.297e-48                0
   5.153e-26       -5.153e-26                0
   6.398e-22       -6.398e-22                0
   7.813e-22        7.813e-22                0
   8.759e-22       -8.759e-22                0
   5.698e-21       -5.698e-21                0
   1.162e-20       -1.162e-20                0
   1.349e-20       -1.349e-20                0
   1.503e-20       -1.503e-20                0
   2.123e-20        2.123e-20                0
   2.156e-20       -2.156e-20                0
   2.171e-20       -2.171e-20                0
   2.672e-20       -2.672e-20                0
    3.07e-20        -3.07e-20                0
   9.349e-20       -9.349e-20                0
   1.477e-19        1.477e-19                0
    2.18e-19        -2.18e-19                0
   2.519e-19        2.519e-19                0
    2.85e-19         2.85e-19                0
   5.173e-19        5.173e-19                0
   8.873e-19       -8.873e-19                0
   9.439e-19        9.439e-19                0
   9.575e-19       -9.575e-19                0
   1.049e-18       -1.049e-18                0
   1.069e-18       -1.069e-18                0
   6.391e-18       -6.391e-18                0
    6.84e-18        -6.84e-18                0
   7.137e-18       -7.137e-18                0
   9.412e-18       -9.412e-18                0
   1.507e-17        1.507e-17                0
   1.776e-17        1.776e-17                0
   2.053e-17        2.053e-17                0
   2.244e-17       -2.244e-17                0
   2.699e-17        2.699e-17                0
   2.734e-17        2.734e-17                0
   3.675e-17        3.675e-17                0
   3.678e-17        3.678e-17                0
   6.471e-17       -6.471e-17                0
   6.716e-17       -6.716e-17                0
   3.395e-16       -3.395e-16                0
   1.302e-15        1.302e-15                0
   4.638e-07       -7.262e-14        4.638e-07
   4.638e-07       -7.262e-14       -4.638e-07
       0.111            0.111                0
         0.2              0.2                0
      0.3985           0.3985                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
         0.7              0.7                0
        0.85             0.85                0
        0.85             0.85                0
         0.9              0.9                0
         0.9              0.9                0
      0.9881           0.9881                0
        0.99             0.99                0
        1.01             1.01                0
       1.024            1.024                0
        1.15             1.15                0
   1.856e+17       -1.856e+17                0
   3.474e+17       -3.474e+17                0
    8.33e+17        -8.33e+17                0
   9.253e+18        9.253e+18                0
         Inf              Inf                0
         Inf              Inf                0

There are 9 eigenvalue(s) larger than 1 in modulus
for 9 forward-looking variable(s)

The rank condition is verified.

STEADY-STATE RESULTS:

y 0
pi_d_h 0
pi_c 0
r 0
c 0
n 0
d 0
d_b 0
d_s 0
b_b 0
p_dc 0
c_b 0
c_s 0
psi 0
pi_c_h 0
s_c 0
s_d 0
y_c 0
y_d 0
mc_c 0
mc_d 0
n_c 0
n_d 0
wp_d 0
wp_c 0
n_c_b 0
n_d_b 0
n_c_s 0
n_d_s 0
i_d 0
yf 0
a_c 0
a_d 0
shock_mu_c 0
shock_mu_d 0
LTV 0
shock_d_b 0
shock_d_s 0
shock_d_stern 0
c_ast 0
d_ast 0
i_d_ast 0
pi_c_f 0
epsa_c4aux 0
epsa_d4aux 0
epsmu_c4aux 0
epsmu_d4aux 0
epsLTV4aux 0
epsd_b4aux 0
epsd_s4aux 0
epsd_stern4aux 0
epsc_ast4aux 0
epsd_ast4aux 0
epss_c4aux 0
epss_d4aux 0
epsr4aux 0

Loading 116 observations from model_data.xlsx

Initial value of the log posterior (or likelihood): 2198.5016

==========================================================
Change in the covariance matrix = 0.42264.
Mode improvement = 0
New value of jscale = 0.094912

==========================================================
Change in the covariance matrix = 0.99196.
Mode improvement = 0
New value of jscale = 0.14487

==========================================================
Change in the covariance matrix = 0.65628.
Mode improvement = 13.3138
New value of jscale = 0.096492

Optimal value of the scale parameter = 0.096492

Final value of the log posterior (or likelihood): -2211.8154

RESULTS FROM POSTERIOR ESTIMATION
parameters
prior mean mode s.d. prior pstdev

rho_a_c 0.300 0.0426 0.0794 beta 0.2000
rho_a_d 0.300 0.2479 0.0692 beta 0.2000
rho_mu_c 0.300 0.3116 0.0671 beta 0.2000
rho_mu_d 0.300 0.8945 0.0633 beta 0.2000
rho_LTV 0.300 0.5312 0.0756 beta 0.2000
rho_d_b 0.300 0.8714 0.0535 beta 0.2000
rho_d_s 0.300 0.1499 0.1329 beta 0.2000
rho_d_stern 0.300 0.8262 0.0823 beta 0.2000
rho_c_ast 0.300 0.8454 0.0295 beta 0.2000
rho_d_ast 0.300 0.4822 0.1102 beta 0.2000
rho_s_c 0.300 0.6347 0.0767 beta 0.2000
rho_s_d 0.300 0.7803 0.0529 beta 0.2000
rho_r 0.300 0.0137 0.0234 beta 0.2000
rho_yf 0.300 0.0937 0.1211 beta 0.2000
theta_d 0.300 0.2486 0.0859 beta 0.1500
theta_c 0.750 0.5102 0.0489 beta 0.1500
sigma 1.000 1.5002 0.0520 gamm 0.7000
phi 3.000 14.6320 1.0553 gamm 2.0000
omega 0.200 0.0708 0.0300 beta 0.1000
h_c 0.500 0.0309 0.0232 beta 0.2000
gamma 0.500 0.2899 0.0214 beta 0.2000
alpha_c 0.500 0.1330 0.0262 beta 0.1000
alpha_d 0.500 0.5298 0.0453 beta 0.1000

standard deviation of shocks
prior mean mode s.d. prior pstdev

epsa_c 0.100 0.0169 0.0017 invg 2.0000
epsa_d 0.100 0.0658 0.0163 invg 2.0000
epsmu_c 0.100 0.0497 0.0392 invg 2.0000
epsmu_d 0.100 0.0454 0.0324 invg 2.0000
epsLTV 0.100 0.0466 0.7365 invg 2.0000
epsd_b 0.100 0.0445 0.0195 invg 2.0000
epsd_s 0.100 0.0274 0.0062 invg 2.0000
epsc_ast 0.100 0.0143 0.0012 invg 2.0000
epsd_ast 0.100 0.0457 0.0219 invg 2.0000
epsd_stern 0.100 0.0303 0.0085 invg 2.0000
epss_c 0.100 0.0118 0.0006 invg 2.0000
epss_d 0.100 0.0381 0.0117 invg 2.0000
epsr 0.100 0.0121 0.0007 invg 2.0000
epsyf 0.100 0.0174 0.0018 invg 2.0000
epsa_c4 0.100 0.0170 0.0019 invg 2.0000
epsa_d4 0.100 0.0441 0.0139 invg 2.0000
epsmu_c4 0.100 0.0454 0.0319 invg 2.0000
epsmu_d4 0.100 0.0463 0.0445 invg 2.0000
epsLTV4 0.100 0.0459 0.0374 invg 2.0000
epsd_b4 0.100 0.0475 0.0324 invg 2.0000
epsd_s4 0.100 0.0206 0.0047 invg 2.0000
epsc_ast4 0.100 0.0118 0.0005 invg 2.0000
epsd_ast4 0.100 0.0480 0.0414 invg 2.0000
epsd_stern4 0.100 0.0214 0.0039 invg 2.0000
epss_c4 0.100 0.0118 0.0005 invg 2.0000
epss_d4 0.100 0.0464 0.0105 invg 2.0000
epsr4 0.100 0.0119 0.0010 invg 2.0000

Log data density [Laplace approximation] is 2031.102011.

Estimation::mcmc: Multiple chains mode.
Estimation::mcmc: Searching for initial values…
Estimation::mcmc: I couldn’t get a valid initial value in 100 trials.
Estimation::mcmc: You should Reduce mh_init_scale…
Estimation::mcmc: Parameter mh_init_scale is equal to 0.400000.
Estimation::mcmc: Enter a new value…

What does it mean?

Regards,

Dear,

Anyone can help me? Any help is highly appreciated. Thanks in advance.

Regards,

Q1, Often you cannot tell. Sometimes it is easy to tell because a parameter runs to the lower/upper bound and thus e.g. drops out of the model. In these cases it is easy to detect. In others, not so much. To illustrate why something like this can happen, imagine a case where you estimate the government spending autocorrelation and the share of government spending in GDP. Say your share of G in Y is for some strange reason estimated to be 0. In this case, G does not enter your model anymore and there might be no information left to estimate the autocorrelation. This problem won’t show up if you test identification initially for a different value of the government spending share.

Q2, This is stange behavior. Could you please provide me with all required files to replicate the problem in a zip-file?

One more thing: given the continuous problems you report, take a step back and try to find out whether the parameters you estimated look sensible compared to the previous literature. If they still look really strange, you are either stuck at a strange local mode that is not the true mode or there is still some fundamental problem in either the model equations or the data treatment.