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.

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;.

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.

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.

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!

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.

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!

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.

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.

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.