Dear all,

I built a new DSGE model based on SW2007. In my model, I introduced the state enterprise. I’m trying to use Dynare to calibrate the model. But I got “The steady state contains NaN or Inf”. I use the code is based on SW2007. When I only consider the private enterprise or state enterprise, the code can work correctly. But I combine two enterprises into the code, it get the above error. I have careful checked the code and calculate the steady state values by hand. I really don’t know where the problem came from.

Many Thanks for your help!

Best,

Wangkaiming

usmodel_shock_decomp.zip (2.9 KB)

usmodel_stst.zip (524 Bytes)

You need to initialize all parameters if you want to run any commands on the model before estimation. As the program says

```
Warning: Some of the parameters have no value (constepinf, constebetag, constebetah, ccs, cinvs, crdpi, cmap, cmaw,
curvw, crhow, cb) 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...
```

Dear Professor J. Pfeifer,

Thank you so much for your help. Following your advice, I assign values to all parameters, but the model can’t obtain the steady state. It also got

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

1 至 22 列

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

23 至 44 列

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

45 至 60 列

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

I don’t know what is wrong. Appreciate your help!!!

usmodel_shock_decomp.zip (2.9 KB)

usmodel_stst.zip (524 Bytes)

usmodel_data.mat (1.2 KB)

No, you did not. Dynare 4.5.3 still warns

```
Warning: Some of the parameters have no value (constepinf, constebetag, constebetah, ccs, cinvs, crdpi, cmap, cmaw,
curvw, crhow, cb) 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...
```

I’m sorry, I paste the wrong appendix. I paste the new appendix. I assign values to all parameters, but the model can’t obtain the steady state. It got

In evaluate_steady_state (line 263)

In model_diagnostics (line 74)

In usmodel_shock_decomp (line 597)usmodel_stst.mod (927 Bytes)

usmodel_shock_decomp.mod (8.5 KB)

usmodel_data.mat (1.2 KB)

In dynare (line 223)

警告: 矩阵为奇异工作精度。

MODEL_DIAGNOSTICS: The steady state cannot be computed

MODEL_DIAGNOSTICS: Steady state contains NaNs

In evaluate_steady_state (line 263)

In dynare_estimation_init (line 561)

In dynare_estimation_1 (line 116)

In dynare_estimation (line 105)

In usmodel_shock_decomp (line 616)

In dynare (line 223)

警告: 矩阵为奇异工作精度。

dynare_estimation_init:: The steady state at the initial parameters cannot be computed.

错误使用 print_info (line 90)

The steady state contains NaN or Inf

出错 dynare_estimation_init (line 565)

print_info(info, 0, options_);

出错 dynare_estimation_1 (line 116)

dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);

出错 dynare_estimation (line 105)

dynare_estimation_1(var_list,dname);

出错 usmodel_shock_decomp (line 616)

oo_recursive_=dynare_estimation(var_list_);

出错 dynare (line 223)

evalin(‘base’,fname) ;

Dear Professor J. Pfeifer,

Thank you so much for your help. I add the the steady_state_model-block. But the steady state at the initial parameters cannot be computed. Why?

usmodel_shock_decomp.mod (10.3 KB)

Because you changed the model. Now you need to adjust the steady state value for `robs`

to reflect these changes. Put `resid;`

before the estimation command to see the residual.

1 Like

Thanks so much jpfeifer!

I have revised my code, I have introduced state assets, the government expenditures and the labor supply for state enterprise. The residuals of the static equations are all 0. But another question arise, it is the collinear relationship.

Then MODEL_DIAGNOSTICS shows: The Jacobian of the static model is singular, there is 3 colinear relationships between the variables and the equations. The singularity seems to be (partly) caused by the presence of a unit root, as the absolute value of one eigenvalue is in the range of ±1e-6 to 1. If the model is actually supposed to feature unit root behavior, such a warning is expected, but you should nevertheless check whether there is an additional singularity problem. The presence of a singularity problem typically indicates that there is one redundant equation entered in the model block, while another non-redundant equation is missing. The problem often derives from Walras Law.

I want to know how to judge the unit root, and how to avoid unit root. I post my mod file. In my code, h denotes private enterprise; g denotes government or state enterprise.

Thanks again.usmodel_shock_decomp.mod (10.5 KB)

wangkaiming

You need to find out why there is now a unit root. Please run `stoch_simul`

before going to estimation. The BK conditions are not satisfied for your parameterization/model.

The equation

```
gf= gf(1)-rrf+(sg-sg(1));//19
```

looks like it will introduce a unit root, because it give a relation in growth rates.

Thanks so much jpfeifer!

The **rrf** is the variable **r** in the flexible economy in SW2007. I careful check my code, I find that the collinear relations come from the equation 13 and 14:

cf = (chabbh/cgamma)/(1+chabbh/cgamma)*cf(-1) + (1/(1+chabbh/cgamma))*cf(+1) - (1-chabbh/cgamma)/( (1+chabbh/cgamma))*(rrf) + b-b(1) ;//13

gf= (chabbg/cgamma)/(1+chabbg/cgamma)*gf(-1) + (1/(1+chabbg/cgamma))*gf(+1) - (1-chabbg/cgamma)/( (1+chabbg/cgamma))*(rrf) + sg-sg(1) ;//14

the equation 13 is the consumption equation, the equation 14 is the government spending equation. The other collinear equations all come from these two equations. I don’t know what reason. And I have another question is that there is no government spending variable **gf** in the flexible economy in SW2007, it used **g** instead it. In my code if I use *g* instead **gf** in equation 14, the collinear ration still existence, but the code can be run.

gf= (chabbg/cgamma)/(1+chabbg/cgamma)*g(-1) + (1/(1+chabbg/cgamma))*g(+1) - (1-chabbg/cgamma)/( (1+chabbg/cgamma))*(rrf) + sg-sg(1) ;//14

Thanks again

20041254_ colinear.zip (1.4 MB)