Error: in the Rank Condition


I am trying to run the attached NK model with some form of non Ricardian consumers with Dynare (version 4.6.4). The intention is to run the calibrated model first then later run the model with real data. The code runs fine when I exclude the aspect on foreign economy data related equations (last 5 equations). However, I keep getting the error below when I include those equations. I have read a lot of useful solutions on this platform (thanks to @jpfeifer and the team) and understand that the issue is most likely about timing or parameter values. But truth is I have tried for days and I don’t think I know how to fix it. Please help!

HANK_cal_2.mod (7.3 KB)

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

The rank condition ISN’T verified!

Error using print_info (line 32)
Blanchard & Kahn conditions are not satisfied: no stable equilibrium.

Error in stoch_simul (line 107)
print_info(info, options_.noprint, options_);

Error in HANK_cal_2.driver (line 577)
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);

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


d_y_star = d_y_star - d_y_star(-1);


d_y_star = y_star - y_star(-1);


wow!! thank you very much @jpfeifer. Lesson well learnt. I will critically examine the codes for errors of this nature next time.

Hi Prof @jpfeifer ,

I managed to run the codes with my data. However, I am concerned about a number of my trace and MCMC univariate graphs. I would be grateful if you could take a look at the attached sample graphs and advise on the possible ways to resolve them.

  1. Are the trace graphs ok? most of them are very fine, however I feel these ones are not good enough.

  2. The mode check plots shows that most of my AR(1) parameters have a corner solution. I read from previous post here that rescaling the parameters or using the mode of the previous estimates could resolve this. What do you suggest I do in such situations. I have read a number of post on this but did not really understand them well.

  3. MCMC univariate graphs like SE_EOBS_D_OBS are trending upwards. Is this issue link to the many corner solution in the mode check plots? How do I fix that?

I used this command for the estimation:
estimation(datafile=ghusdata, prefilter=1, mode_compute = 4, mh_replic=100000, mh_nblocks=2,prior_trunc=0,mh_drop=0.45,mh_jscale = 0.30, first_obs = 22, mode_check)

I have attached the log file for the estimation.

GH_SOE_est_full_Analysis.log (66.8 KB)
Diagnostics_HANK.pdf (432.5 KB)

The most worrying thing are the flat likelihood kernels, suggesting that some parameters are not identified. Did you check identification?

1 Like

No I didn’t. Can you please show me how to check for identification or direct me to a source that could be of assistance?

Run the identification-command. See e.g. Identification Analysis of DSGE model parameters with Dynare - YouTube

Will do that now. Thank you very much.

Good day Prof. @jpfeifer

I managed to run the identification as suggested and got the results below. The video was really helpful.
My model contains specifications for the standard errors of the observables in the estimated_param block so Dynare did not allow for me to run the identification initially. I deleted the standard errors specifications and focused on the parameters to be estimated as suggested in the video.

See attached the mode file used for running the identification. I would appreciate your advise on whether I did the identification well, and what I can do to fix the issue of irregular mode plots.

I also would like to know if it is good practice to not include the standard errors of the observable variable in the estimated_param block.

Diagnostics-HANK.pdf (366.7 KB)
HANK_New_ident.mod (11.0 KB)

All parameters are identified in the Jacobian of steady state and reduced-form solution matrices (rank(Tau) is full with tol = robust).

All parameters are identified in the Jacobian of mean and spectrum (rank(Gbar) is full with tol = robust).

All parameters are identified in the Jacobian of first two moments (rank(J) is full with tol = robust).

Hi @jpfeifer ,

I hope you are well. I will be grateful if you could take a look at my last post and let me know what you think about the identification and mode. Thanks in advance.

  1. Can you provide the data file. It’s a bit strange that everything is identified, but the likelihood seems flat.
  2. For the purpose of identification, a workaround is to specify measurement errors like structural shocks instead of using the Dynare interface. Those two options are isomorphic.

Please find attached the data file. Thanks in advance. ghusdata_sadjimp.mat (4.4 KB)

Why is your data not mean 0, but the observables in the model are?

Thanks for pointing this out. I am new to DSGE modeling and my understanding was stationary data means it has a mean of zero. I guess it I lacked understanding in that regard. Please how to I fix that?

The data is already seasonally adjusted and log first differenced. How do I get a mean zero for such data. Or do I maintain the data and rather do something to the model.

Should I simply subtract the mean of each sample from each observation to obtain a zero mean and then use the data in the model? Will doing this affect my data properties?

Please have a look at Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”

Hi Prof @jpfeifer ,

So, I read your paper in detail and tried all options of transforming the data (log difference, the HP filter and the demeaned method, but none of the data used gave me a well behaved mode plots. Everything else ( including the MCMC and trace plots) are fine. Is it the case that I cannot use the model for anything useful if all the mode plots are not well behaved., or I can simply restrict my analysis to the parameters with good enough mode plots.

Please settle on one way of specifying the observation equation, treat the data accordingly, and then provide the updated files.

Hi Prof @jpfeifer ,

Apologies for the delay in reply. I encountered an emergency which required my full attention. Please find attached the mode and data file. Model_Linear2.mod (7.8 KB)
Data_demean.mat (3.9 KB)

So my model is log-linearised and according to your guide, the variables are log deviations from a steady of zero and they have zero means. These are how I transformed the variables:

Output: I log real output and applied the one sided HP filter. The resulting variable had a positive mean so I demeaned it using the procedure in your guide. The results are similar if I use the variable without demeaning.

Inflation: demeaned after calculating the log difference as log(cpi/cpi(-1)) - mean(log(cpi/cpi(-1))

Depreciation: use same method as inflation

Interest rate: transformed to quarterly series using the formula (1 + (r / 100))^0.25 -1

Your assistance in fixing my poor mode plots would be very much appreciated.

Hi @jpfeifer ,

I hope this message finds you well. Please did you manage to take a loot at the codes?