# It appears"The steady state has NaNs or Inf"

Dear professer,
Untitled519.mod (3.9 KB)

When I run my dynare code, it appears that “The steady state contains NaN or Inf”.I don’t know where I am wrong and how to correct my code

I really need help. Thank you very much.

Best,
zhang

You use K_{ss}^{g} in order to define to define Y_{ss}. However, you define K_{ss}^{g} after Y_{ss}, which causes NaN on Y_{ss} and on the rest of the steady-state variables dependant on Y_{ss} . You need to find another way to compute your analytical steady-state.

Thank you very much for your reply, I wonder why this problem occurs, the steady-state value is written according to the equilibrium conditions. As a beginner, I don’t know how to fix it, can you tell me how I should correct it，thank you again！

I would advise you to normalize Y_{ss} to 1, which would allow you to define I^{g}_{ss} by multiplying the ratio of public investment to GDP with Y_{ss} (1). This would then allow you to calculate K_{ss}^{g}. However, if you use this method, since you normalize Y_{ss} to 1, do not forget to adjust steady-state TFP A_{ss}.

sorry，I’m still wondering, can you go into more details?Idont know how to adjust steady-state TFP Ass

Like this:

A_{ss}=Y_{ss}/(K_{ss}^{\alpha}H_{ss}^{1-\alpha}(K^{g}_{ss})^{\alpha_{g}})

Untitled519.mod (3.9 KB)
I thought maybe I misunderstood what you meant, and I did it or wasn’t right. Please see if I have made a mistake，thank you

Another mistake arises because of the cobb-douglas production function. \alpha +(1-\alpha)+\alpha_g > 1. Also do not forget to modify A=0 in initval since TFP is not anymore equal to 1 in the steady-state. Moreover, you also forgot to assign K_{g} to its steady-state in initval, and you also need to adjust the steady-state rax rule by adding i^{g}_{ss} to it.

This code ran successfully, very very thank you for your help！！！

Hello Professor, sorry to bother again. I have six shocks set up in my model, so why do I only get five irf pictures when I run the code?Please help me see where my problem is, thank you very much
Untitled520.mod (4.0 KB)

\tau is a lump-sum tax and neither appears in the FOC nor in the rest of the model written down in dynare (at the exception of the government budget constraint). Hence, it is normal that dynare does not produce IRFs (This statement should be confirmed by Professor Pfeifer).

If you want to produce IRFs after a tax shock, I would advise you to introduce a distortionary tax.

Use

stoch_simul(order=1,irf=60,irf_plot_threshold=0) Y i c h qk pi tau;

to see that the shock only moves tau.

Thank you for your reply and guidance, Professor Pfeifer also replied to me, I tried it according to his method. But there are some problems with the results, the change in the impulse response of consumption in the graph of the tax shock is a horizontal line, is this normal? Why are changes in labor, investment, and output not smooth?

Thank you for your reply, I tried it according to your method. But there are some problems with the results, the change in the impulse response of consumption in the graph of the tax shock is a horizontal line, is this normal? Why are changes in labor, investment, and output not smooth?

These IRFs are simply 0. Look at the scaling of the y-axis.

Araujo_2012.mod (3.2 KB)

Dear Prof. Pfeifer

I am replicating the SOE RBC model of the paper “Investment-specific shocks and real business cycles in emerging economies: Evidence from Brazil” by Eurilton Araújo.

I received the message "The steady state has NaNs or Inf when I ran the file without the steady_state_model.

But I received the message “variable ‘h’ is undefined in the declaration of variable 'c_h” while running the code with the steady_state_model. I understand that I need to define h in the steady_state_model. But from FOC of labor I could not define h.

Could you please take a look at the mode file?

Thanks and regards

Saidul

Hi, you have forgotten to define the steady-state of variable “h”. Find the steady-state of this variable and if your code is correct, your model should be solved by dynare.