Something wrong with the steady state

Hi everyone here, thanks for reading my question!
I have a question of steady state with the following code:
nk2c0201.mod (10.8 KB)
Could anyone tell me how to find the equation which is wrong in the code?
Thank you very much for any advice!

The message obtained from matlab is:

STEADY: numerical initial values or parameters incompatible with the following equations
43 44

Check whether your model is truly linear. Put “resid(1);” before “steady;” to see the problematic equations.
Error using print_info (line 32)
The steady state has NaNs or Inf.

Error check (line 48)
print_info(info, 0, options);

Error nk2c0201.driver (line 733)
oo_.dr.eigval = check(M_,options_,oo_);

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

Chss and Cfss are zero, which leads to division by zero and thus NaN for example in equations:

	b = (Rss*b(-1) + Yhss/Chss*( px_h + x_h - y_h ))*(1-zg);
    b_f = (Rhss*b_f(-1) + Yfss/Cfss*( px_f + x_f - y_f ))*(1-zg);

You also had the check; command before you declared the shocks and again afterwards. Uncomment it there and you will see more information, you can also add model_diagnostics;.

1 Like

Thanks for your help!
I found that there are something wrong with the calculation of Chss and Cfss. I change them now.
The model still tell me :

Error using print_info (line 32)
The steady state has NaNs or Inf.

Error steady (line 102)
print_info(info,options_.noprint, options_);

Error nk2c0201.driver (line 747)
steady;

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

And I add model_diagnostics; and check; after steady; now, but I still feel confuse about how to interpret the information offered by the code above (check; and model_diagnostics;)
Could you please tell me how to find equations which have problem by reading the information offered by matlab?
And what is wrong with the code?
Again, thank you very much!

Here is the code (different from the orginal version):
nk2c0201.mod (11.1 KB)

The problem is from your calculation of steady state parameter.

One example, in:
Khss = Hss^((alpha-1)/(alpha-1-alpha*phi_house))*(Zhss/(alpha*MCss*(1-phi_house)))^(1/(alpha-phi_house*alpha-1))*kh_h^(phi_house*alpha/(alpha*phi_house+1-alpha));

kh_h is included, which is a variable and thus it does not work as Dynare sets variables to zero. This makes all the *ss parameters that you define to zero. You should recheck all the steady state parameters. In the end you should be able to one-by-one run them with f9 and get sensible numbers.

Indeed, see

Thank you very much for your reply, doctor DoubleBass!
This is the first time I konw f9 and it is useful for me to debug in the steady state.
Now I repair the steady state part and there are no errors when running with f9.
But matlab also tell me :

Error using print_info (line 32)
The steady state has NaNs or Inf.

Error steady (line 102)
print_info(info,options_.noprint, options_);

Error nk2c0201.driver (line 747)
steady;

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

I am confused about the next step to fix the model. I have no idea about this.
Could you please offer me some advice of the next step of fixing the model?
Thanks for your help!

Here is the code:
nk2c0201.mod (11.6 KB)

Thanks for your reply,Professor JPfeifer!
May I ask if there is an electronic version of this content, like PDF?

I ran your code and it shows NaN as residuals of equations 15 and 16. Start there. If possible, try to start with a smaller and simpler model, as @jpfeifer has mentioned countless times, it makes things easier.

@wmutschl has fantastic stuff on his webpage 📈 Dynare | Willi Mutschler. Maybe that’s what you are looking for.

There are still things that do not work. As VS19 told you the equations 15 and 16 seem to cause the problems. You should put the model_diagnostics; first. This way it gives you more information.

The issue is similar to what you had before, because of your parameters, you are dividing by zero in these two equations. 15 for example is:
aa_h*i_h*z * delta_h*fs_h/(1-aa_h) = k_h-(1-delta_h)*k_h(-1)*(1-fs_h);,
where if you check carefully (1-aa_h) = 0.

Setting:

aa_h=0.5;                       % the cost of investment in i
aa_f=0.5;
fs_h=0.5;                       % the cost of holding k(-1)
fs_f=0.5;

(I do not know whether these parameters make sense since I do not know the model) let’s the model run and you can start tackling the next issue which is indeterminacy. Have a look in the forum about this issue.

Thank you for offering me advice and a useful webpage!
Professor jpfeifer told me start from a simpler one year ago, so I use this model which I can understand the calculation in the model. I think my problem is that I don’t know how to debug by using the information offered by matlab and Idon’t know where I can get relevant information. So I cannot edit the model successfully.
Now I think I get some information of how to debug about steady state, thank you very much!

Thanks for your advice!
As you said, matlab tell me a new bug of my code:
The rank condition ISN’T verified!

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

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

Error nk2c0201.driver (line 753)
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);

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

After I browsed the forum, my initial idea is to modify the value of parameters, delete some parameters to make the model easier, and use diffuse_filter which I saw from the response from professor jpfeifer to other people.
I am no sure whether my idea is correct. I would appreciate it if you could give me some advice.

Here is the orginal paper:
chapter_6(orginal).pdf (481.5 KB)
It is a standard NK two country model.
What I’m doing is adding a new asset, and the intermediary firms use two kinds of asset to product X. Now the two assets are set exactly the same, more specific Settings will be added once the model is ready to run.

Thanks for your suggestions!

But does the original model without modifications work?

Yes, this is the previous version of the code. I start from here to build a new kind of capital in the model.
The orginal model is a standard NK two country model for teaching.

nk2c0106.mod (8.8 KB)

I see. And where is the current version that provides the above error message?

Thanks for your reply, Professor jpfeifer!
In the code, I use’HERE’ to mark the equation added by me. (I don’t mark the equation changed by me)

Here is the code:
nk2c0202.mod (11.9 KB)

Here is the information offered by matlab:

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

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

Error nk2c0202.driver (line 753)
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);

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

Now there is explosiveness. Have you tried different parameterizations? If that does not help, it must be the timing/setup.

Thanks for your reply!
I want to make sure I understand you correctly.
Does this mean that tweaking the parameters might solve the problem? And if that doesn’t work, consider the timing or model setup error?
I’ve tweaked a few parameters before, but with little success.
Thanks for your advice of adjusting the code!

Yes, there is explosiveness, i.e. one of the stocks (typically capital or bonds) do not have a finite solution. Sometimes that is just a matter of parameters like the elasticities in fiscal rules. At other times, there is a fundamental mistake in the stabilizing mechanisms.

Thanks for your advice, professor jpfeifer!
Now I have the code working, there are some calculation error in the steady state.