Error using print_info (line 32)-Error in steady (line 102)-Error in nkbb.driver (line 364)-Error in dynare (line 293)

Dear All,
I changed the values of the parameters of NKB file in NKBB file .The NKB file had no error in running but when I run the NKBB file i encounter the following errors. Would you help me please?
thanks
Error using print_info (line 32)
The steadystate file did not compute the steady state

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

Error in nkbb.driver (line 364)
steady;

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

NKB.mod (7.4 KB)
NKBB.mod (7.4 KB)

1 Like

You have

Equation number 16 : 0.00022511 : Marginal Costs

so there is an inconsistency between the equation and the steady state.

I am a beginner in this field, would you please tell me why this problem does not occur in the first file? And how can it be fixed? should I change the parameter value associated with the marginal costs?
thanks

As I said, your entered equations and the computed steady state values are inconsistent. There must be a mistake somewhere, but it is unclear whether it is the model equations or the steady state computation that has the mistake.

Hello, what I can suggest is to use “initval” instead of “stead_state_model”. Best,
FgB

1 Like

Thanks for your responding.Is it possible to use “initval” instead of “steady_state_model” in the calibration approach?

I am not sure what you mean with “calibration approach”. I just noticed that your code works when using initval instead of steady_state_model.
If what you want is to calibrate some parameters’ values to match some data ratios you can also use initval for finding the steady states of the model. Of course, it is a matter of giving good aproximations to the initial values, and that there is actually a steady state.

1 Like

I really appreciate your help.

1 Like

I disagree with @fernando. initval is for cases where you are not able to compute steady states analytically and you want to try it numerically. But here, the steady state was computed analytically, but it does not solve the entered model equations. That is valuable information, because the inconsistency points to a mistake somewhere. For that reason I would always try to resolve the inconsistency instead of simply switching to a numerical steady state. How do you know that the mistake is not in the model equations for which a numerical steady state was found?

My mistake, I didn’t explain myself, or maybe I got it wrongly since the beginning. Please @jpfeifer let me know whether I am incorrect. I understand that by using initval we are solving numerically. Perhaps there are some typos in the equations in the steady_state_model section. Hence, by substituting the steady_state_model by initval, then we are using the expressions as just approximations for solving numerically regardless of the typos (all this thinking that there are not typos in the model equations).
As Johannes suggests, have a look at the model equations and the analytical solution you obtained, perhaps there are some typos.

@fernando is correct if you are 100% sure the mistake is in the steady state computations, not in the model itself. But usually we don’t know where the mistake is located.

1 Like

I don’t think there are a typos in the equations because no errors are reported in NKB file. And the error happens when i changing the values of some parameters . By using “initval” instead of “steady_state_model" the values of W_M, W_F, V_M and d_F variables in the steady state corresponds to the manual calculations I did based on optimal conditions equations up to four decimal places.

Again, that should not happen. Your steady state computations should hold for any value of the parameters. But if you think your steady state makes sense, t hen go ahead with initval.

1 Like

quality_code_works.rar (8.5 KB)
Dear dynare people,
I have the same problem Heidarz posted (see full code in the rar-file). It works if, for instance, you change nu to 0.67. (For some other values, I can do a “trick” indicated in line 216 of dyn_main.mod. Something I don’t like at all because the code should work without it).
After manually recalculating the equations of the model and the steady state ones (the latter are in sseqs.m, dyn_det.m and dyn_main_steadystate.m) and checking they are well introduced in the files, I did not manage to find the mistake/s.

My question is, to re-revise it, should I suspect the problem comes from the equations not getting a 0 in the residual list? Any other advise on where to look/how to proceed is welcome…
Thank you so much.

Residuals of the static equations:

Equation number 1 : 0 : cH
Equation number 2 : 0 : YH
Equation number 3 : 0 : WH
Equation number 4 : 0 : qH
Equation number 5 : 0 : pH
Equation number 6 : 0 : dH
Equation number 7 : 0 : mH
Equation number 8 : 0 : yH
Equation number 9 : 0 : lHy
Equation number 10 : 0 : lHq
Equation number 11 : 0 : IH
Equation number 12 : 0 : UcH
Equation number 13 : 0 : wH
Equation number 14 : 0 : kH
Equation number 15 : 0 : 15
Equation number 16 : 0 : 16
Equation number 17 : 0 : nH
Equation number 18 : 0 : 18
Equation number 19 : 0 : zH
Equation number 20 : 0.13025 : gdpH
Equation number 21 : 0.00092195 : exH
Equation number 22 : 0 : mYH
Equation number 23 : 0 : mxH
Equation number 24 : 0 : mcH
Equation number 25 : 0 : totH
Equation number 26 : -0.47461 : PH
Equation number 27 : 0 : rerH
Equation number 28 : 0 : nxH
Equation number 29 : 0 : RYH
Equation number 30 : 0 : RCH
Equation number 31 : -4.7799 : qadjH
Equation number 32 : 0 : qgdpH
Equation number 33 : 0 : qexH
Equation number 34 : 0 : qYH
Equation number 35 : 0 : qxH
Equation number 36 : 0 : qcH
Equation number 37 : 0 : qtotH
Equation number 38 : -0.47461 : qPH
Equation number 39 : 0 : qrerH
Equation number 40 : 0 : qnxH
Equation number 41 : 0 : qRYH
Equation number 42 : 0 : qRCH
Equation number 43 : 0 : cF
Equation number 44 : 0 : YF
Equation number 45 : 0 : WF
Equation number 46 : 0 : qF
Equation number 47 : 0 : pF
Equation number 48 : 0 : dF
Equation number 49 : 0 : mF
Equation number 50 : 0 : yF
Equation number 51 : 0 : lFy
Equation number 52 : 0 : lFq
Equation number 53 : 0 : IF
Equation number 54 : 0 : UcF
Equation number 55 : 0 : wF
Equation number 56 : 0 : kF
Equation number 57 : 0 : 57
Equation number 58 : 0 : 58
Equation number 59 : 0 : nF
Equation number 60 : 0 : 60
Equation number 61 : 0 : zF
Equation number 62 : 0.13025 : gdpF
Equation number 63 : 0.00092195 : exF
Equation number 64 : 0 : mYF
Equation number 65 : 0 : mxF
Equation number 66 : 0 : mcF
Equation number 67 : 0 : totF
Equation number 68 : -0.47461 : PF
Equation number 69 : 0 : rerF
Equation number 70 : 0 : nxF
Equation number 71 : 0 : RYF
Equation number 72 : 0 : RCF
Equation number 73 : -4.7799 : qadjF
Equation number 74 : 0 : qgdpF
Equation number 75 : 0 : qexF
Equation number 76 : 0 : qYF
Equation number 77 : 0 : qxF
Equation number 78 : 0 : qcF
Equation number 79 : 0 : qtotF
Equation number 80 : -0.47461 : qPF
Equation number 81 : 0 : qrerF
Equation number 82 : 0 : qnxF
Equation number 83 : 0 : qRYF
Equation number 84 : 0 : qRCF
Equation number 85 : 0 : bH

Error using print_info (line 32)
The steadystate file did not compute the steady state
Error in steady (line 102)
print_info(info,options_.noprint, options_);
Error in dyn_main.driver (line 761)
steady;
Error in dynare (line 293)
evalin('base',[fname '.driver']) ;
Error in dyn_calibration (line 6)
dynare dyn_main.mod noclearall

Before continuing, please use a proper steady state file as discussed in Steady State Error
When doing so, please add an indicator on whether your call to fsolve succeeded.

Dear Dr. Pfeifer,
Thanks for all your help and patience… I actually use the steady state file you helped me to setup. It does work for an specific calibration.dyn_main.mod (12.4 KB) In this file, I just changed nu and it works with the steady state files previously uploaded… dyn_main_steadystate.m (2.9 KB) (the same I uploaded)
Now, I have added a dbstop “dbstop in dyn_main_steadystate.m at 23 if error” and I run dyn_main.mod with nu=.37;
The outcomes are:

Using 64-bit preprocessor
Starting Dynare (version 4.6.2).
Calling Dynare with arguments: noclearall
Starting preprocessing of the model file ...
Found 85 equation(s).
Evaluating expressions...done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 1).
Processing outputs ...
done
Preprocessing completed.

Undefined operator '-' for input arguments of type 'struct'.
Error in dyn_det (line 32)
  d3 = kH - IH*FH;
Error in dyn_main_steadystate>@(X)dyn_det(X) (line 23)
  X  = fsolve(@(X) dyn_det(X),X0,options);
Error in fsolve (line 242)
        fuser = feval(funfcn{3},x,varargin{:});
Error in dyn_main_steadystate (line 23)
  X  = fsolve(@(X) dyn_det(X),X0,options);
Error in evaluate_steady_state_file (line 49)
[ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);
Error in evaluate_steady_state (line 210)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M,
options,steadystate_check_flag);
Error in steady_ (line 55)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 80)
[oo_.steady_state,M_.params,info] = steady_(M_,options_,oo_);
Error in dyn_main.driver (line 761)
steady;
Error in dynare (line 293)
evalin('base',[fname '.driver']) ;
Error in dyn_calibration (line 6)
dynare dyn_main.mod noclearall 
247             rethrow(userFunExcept)

In

  [cH, YH, WH, qH, pH, dH, mH, yH, lHy, lHq, IH, UcH, kH. RH, ...
   cF, YF, WF, qF, pF, dF, mF, yF, lFy, lFq, IF, UcF, kF, RF] = sseqs(X);

there is a dot instead of a comma after kH.

Sorry. This is a typo I generated yesterday. Matlab was telling me it was better practice to use , instead of spaces and I put the , (and the incorrect .).
If I use the dbstop in line 23 (where fsolve is) or in line 24 of _steadystate.m, no error is reported.
If I change the value of a parameter in dyn_main then, the error is:

>> dbstop in dyn_main_steadystate.m at 23 if error
>> dyn_calibration
Using 64-bit preprocessor
Starting Dynare (version 4.6.2).
Calling Dynare with arguments: noclearall
Starting preprocessing of the model file ...
Found 85 equation(s).
Evaluating expressions...done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 1).
Processing outputs ...
done
Preprocessing completed.





Residuals of the static equations:

Equation number 1 : 0 : cH
Equation number 2 : 0 : YH
Equation number 3 : 0 : WH
Equation number 4 : 0 : qH
Equation number 5 : 0 : pH
Equation number 6 : 0 : dH
Equation number 7 : 0 : mH
Equation number 8 : 0 : yH
Equation number 9 : 0 : lHy
Equation number 10 : 0 : lHq
Equation number 11 : 0 : IH
Equation number 12 : 0 : UcH
Equation number 13 : 0 : wH
Equation number 14 : 0 : kH
Equation number 15 : 0 : 15
Equation number 16 : 0 : 16
Equation number 17 : 0 : nH
Equation number 18 : 0 : 18
Equation number 19 : 0 : zH
Equation number 20 : 0.00054885 : gdpH
Equation number 21 : 3.8911e-06 : exH
Equation number 22 : 0 : mYH
Equation number 23 : 0 : mxH
Equation number 24 : 0 : mcH
Equation number 25 : 0 : totH
Equation number 26 : -0.0012153 : PH
Equation number 27 : 0 : rerH
Equation number 28 : 0 : nxH
Equation number 29 : 0 : RYH
Equation number 30 : 0 : RCH
Equation number 31 : 0.028729 : qadjH
Equation number 32 : 0 : qgdpH
Equation number 33 : 0 : qexH
Equation number 34 : 0 : qYH
Equation number 35 : 0 : qxH
Equation number 36 : 0 : qcH
Equation number 37 : 0 : qtotH
Equation number 38 : -0.0012153 : qPH
Equation number 39 : 0 : qrerH
Equation number 40 : 0 : qnxH
Equation number 41 : 0 : qRYH
Equation number 42 : 0 : qRCH
Equation number 43 : 0 : cF
Equation number 44 : 0 : YF
Equation number 45 : 0 : WF
Equation number 46 : 0 : qF
Equation number 47 : 0 : pF
Equation number 48 : 0 : dF
Equation number 49 : 0 : mF
Equation number 50 : 0 : yF
Equation number 51 : 0 : lFy
Equation number 52 : 0 : lFq
Equation number 53 : 0 : IF
Equation number 54 : 0 : UcF
Equation number 55 : 0 : wF
Equation number 56 : 0 : kF
Equation number 57 : 0 : 57
Equation number 58 : 0 : 58
Equation number 59 : 0 : nF
Equation number 60 : 0 : 60
Equation number 61 : 0 : zF
Equation number 62 : 0.00054885 : gdpF
Equation number 63 : 3.8911e-06 : exF
Equation number 64 : 0 : mYF
Equation number 65 : 0 : mxF
Equation number 66 : 0 : mcF
Equation number 67 : 0 : totF
Equation number 68 : -0.0012153 : PF
Equation number 69 : 0 : rerF
Equation number 70 : 0 : nxF
Equation number 71 : 0 : RYF
Equation number 72 : 0 : RCF
Equation number 73 : 0.028729 : qadjF
Equation number 74 : 0 : qgdpF
Equation number 75 : 0 : qexF
Equation number 76 : 0 : qYF
Equation number 77 : 0 : qxF
Equation number 78 : 0 : qcF
Equation number 79 : 0 : qtotF
Equation number 80 : -0.0012153 : qPF
Equation number 81 : 0 : qrerF
Equation number 82 : 0 : qnxF
Equation number 83 : 0 : qRYF
Equation number 84 : 0 : qRCF
Equation number 85 : 0 : bH


Error using print_info (line 32)
The steadystate file did not compute the steady state
Error in steady (line 102)
    print_info(info,options_.noprint, options_);
Error in dyn_main.driver (line 761)
steady;
Error in dynare (line 293)
evalin('base',[fname '.driver']) ;
Error in dyn_calibration (line 6)
dynare dyn_main.mod noclearall 
32      error(message);

But this message now simply means your steady state file does only work for some parameterizations. You need to find out where the mistake is.

Dear Dr Pfeifer,

Do you think the problem may come from how I specify equation (20) of the model? This is supposed to be real GDP. I use “ps” as the steady state price (to have GDP at constant prices) in the model equations. How should I do this in a correct way?
Since the steady state is not yet computed when the model equations are read, this may be a problem, right?
We tried to give value 1 to psH and psF and later we overwrite them (lines 230-235) because the 1 didn’t work (we also have an external function “pss” that I’m not sure it is useful here).
When the steady state is calculated psH may not coincide with what I introduced in the model equations. Since psH and psF change for every parameterization, changes make the code crash.
Thank you so much…
The following file only changes in the parameterization compared to the previous one.
dyn_main.mod (12.5 KB)