# Bayesian estimation：The steady state has NaNs or Inf

Hello everyone！ This is a two country model, where the central banks of countries i and f both issue CBDCs, and the household sector holds both CBDCs. Error in estimating the total factor impact coefficient of country i, using ‘model_ Diagnosis’ and ‘reid (1)’ to check have found that there is a problem with the full factor shock equation in country i. I don’t know how to solve this problem， hope to get some help, thanks!

Blockquote
STEADY: numerical initial values or parameters incompatible with the following equations
62

Check whether your model is truly linear. Put “resid(1);” before “steady;” to see the problematic equations.

Residuals of the static equations:

Equation number 1 : NaN : EQ1-2.demand of consumption equation
Equation number 2 : 0 : lamb_f
Equation number 3 : 0 : EQ3-4.demand of cash
Equation number 4 : 0 : 4
Equation number 5 : 0 : EQ5-6.demand of doesmic CBDC
Equation number 6 : 0 : 6
Equation number 7 : 0 : EQ7-8.demand of forgin CBDC
Equation number 8 : 0 : 8
Equation number 9 : 0 : EQ9-10.demand of domestic bond
Equation number 10 : 0 : 10
Equation number 11 : 0 : EQ11.interest parity condition
Equation number 12 : 0 : EQ12-13.supply of labor
Equation number 13 : 0 : 13
Equation number 14 : 0 : EQ14-15.FOC capital
Equation number 15 : 0 : 15
Equation number 16 : 0 : EQ16-17.capital rise rota
Equation number 17 : 0 : k_f
Equation number 18 : 0 : EQ18-19.Velocity of currency circulation
Equation number 19 : 0 : v_f
Equation number 20 : 0 : EQ20-21.Velocity of CBDC circulation
Equation number 21 : 0 : vdc_f
Equation number 22 : 0 : EQ22-23.relation of cash velocity and CBDC velacity
Equation number 23 : 0 : 23
Equation number 24 : 0 : EQ24-25.domestic supply of CBDC
Equation number 25 : 0 : 25
Equation number 26 : 0 : EQ26-27.forgin supply of CBDC
Equation number 27 : 0 : 27
Equation number 28 : 0 : EQ28-29.supply of CBDC
Equation number 29 : 0 : 29
Equation number 30 : 0 : EQ30-31.supply of cash
Equation number 31 : 0 : 31
Equation number 32 : 0 : EQ32-33.Production function
Equation number 33 : 0 : y_f
Equation number 34 : 0 : EQ34-35.demand of labor
Equation number 35 : 0 : w_f
Equation number 36 : 0 : EQ36-37.demand of capital
Equation number 37 : 0 : rk_f
Equation number 38 : 0 : EQ38-41.Definition price level
Equation number 39 : 0 : pi_ff
Equation number 40 : 0 : pi_i
Equation number 41 : 0 : pi_f
Equation number 42 : 0 : EQ42-43.real Marginal cost
Equation number 43 : 0 : muhat_f
Equation number 44 : 0 : EQ44-45.Domestic inflation rate
Equation number 45 : 0 : 45
Equation number 46 : 0 : EQ46-47.resource constraint
Equation number 47 : 0 : 47
Equation number 48 : 0 : EQ48-49.clear market
Equation number 49 : 0 : 49
Equation number 50 : 0 : EQ50-51.CPI
Equation number 51 : 0 : 51
Equation number 52 : 0 : EQ52-53real exchange rate
Equation number 53 : 0 : 53
Equation number 54 : NaN : EQ54.International risk sharing
Equation number 55 : 0 : EQ55-56.r,r_d and r_dc
Equation number 56 : 0 : r_f
Equation number 57 : 0 : EQ57-58.gdp gap
Equation number 58 : 0 : yhat_f
Equation number 59 : 0 : EQ59.Interest Rate Rule
Equation number 60 : NaN : EQ60-61.Preference shock
Equation number 61 : 0 : eC_f
Equation number 62 : NaN : EQ62-63.TFP shock
Equation number 63 : 0 : eA_f
Equation number 64 : 0 : EQ64.eZ shock
Equation number 65 : 0 : EQ65.Monetary policy shock
Equation number 66 : 0 : y_obs

Blockquote

You commented out

rho_Ai = 0.3414;

so `rho_Ai` is never set.

But I have already removed this command and get ready to estimate the value of rho_Ai through Bayesian analysis

I don’t know why Bayesian estimation failed

What is the error message in that case?

error message is"The steady state has NaN or Inf".
and now, After removing command ‘steady’, the mod file can run successfully.

Without the file it is impossible to tell. But most likely, not all parameters have been set before calling `steady`.

Are parameters estimated by Bayes also unassigned? How to use the Steady command when using Bayesian estimation?
The mod file and data file are as follows:
Bys_PR.mod (10.3 KB)
Bysdata.mat (7.1 KB)

The contents of the `estimated_params`-block are only set within the `estimation`-command. That’s the reason you get

Warning: Some of the parameters have no value (phi_pi, phi_pif, phi_y, phi_yf, rho_Ai, rho_Af, rho_Ci, rho_Cf, rho_Ri, rho_Rf, rho_Z) when using model_diagnostics. If these
parameters are not initialized in a steadystate file or a steady_state_model-block, Dynare may not be able to solve the model. Note that simul, perfect_foresight_setup, and
perfect_foresight_solver do not automatically call the steady state file.

That’s why you should explicitly fully calibrate the model.

So I should first use the estimation-command to estimate the parameters that need to be estimated, then calibrate the parameters with the estimated values.And run a mod with all parameters are calibrated .right?

You need to decide what you want to do. To call `steady` before `estimation`. If you are only interested in `estimation`, remove the `steady`. After `estimation` all parameters will be set.

OK,I get.Thank you Professor Jpfeifer