K_order_perturbation error

Hi guys, I am trying to replicate the paper “Risk Matters: The Real Effects of Volatility Shocks” by Fernandez-Villaverde et al. I get following message:
dynare:k_order_perturbation: Caught Kord exception: NaN or Inf asserted in first order derivatives in FirstOrder::solve
Error using print_info (line 68)
k_order_pert was unable to compute the solution
Error in stoch_simul (line 98)
print_info(info, options_.noprint, options_);
Error in dsge_risks2 (line 275)
info = stoch_simul(var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ;
I don’t know what it meas nor where to start looking on how to solve it
any help would be deeply appreciated
dsge_risks2.mod (3.36 KB)

I have the same problem. Was you able to solve it at the end?

Make sure it runs at order=1. For the posted file, model_diagnostics says:

[quote]MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 1 colinear relationships between the variables and the equations
Colinear variables:
d
k
i
Colinear equations
3 4 6

MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.[/quote]

Replicating the paper is hard. See the comment at dynare.org/wp-repo/dynarewp039.pdf. A rudimentary form of the model can be found at github.com/DynareTeam/dynare/blob/master/tests/decision_rules/third_order/FV2011.mod
Note that the particular IRF generation and pruning used in the original paper is not supported by Dynare.

1 Like

[quote=“jpfeifer”]Replicating the paper is hard. See the comment at dynare.org/wp-repo/dynarewp039.pdf. A rudimentary form of the model can be found at github.com/DynareTeam/dynare/blob/master/tests/decision_rules/third_order/FV2011.mod
Note that the particular IRF generation and pruning used in the original paper is not supported by Dynare.[/quote]

Hi, I also what to find how to get the IFRs using the third-order perturbation method, that’s why I tried the code of FV2011.mod,

But I got the error message in the dynare…:
"
Attempt to execute SCRIPT k_order_perturbation as a function:
C:\dynare\4.4.2\matlab\k_order_perturbation.m

Error in k_order_pert (line 57)
[err, g_0, g_1, g_2, g_3, derivs] = k_order_perturbation(dr, …

Error in stochastic_solvers (line 74)
[dr,info] = k_order_pert(dr,M_,options_);

Error in resol (line 137)
[dr,info] = stochastic_solvers(dr,check_flag,M,options,oo);

Error in stoch_simul (line 88)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

Error in FV2011 (line 285)
info = stoch_simul(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;
"

could you tell me what is wrong here??

Thank u…!!

There is a problem in finding the mex-files. Check if your paths are set correctly. You may also want to try reinstalling Dynare. Also check whether you followed all instructions regarding the mex-files if you are not using a system with precompiled mex-files. If nothing works, please report back with the operating system version and your Matlab/Octave version.

Thank you very much!!!
Now it works… but the result seems limited, and the IRFs didn’t show up… so what if I want to know the IRFs of each variable, especially for the volatility shock??

Or is my result like the way it should be??

The final reported result is like this:
Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0

STEADY-STATE RESULTS:

sigma_r -5.71
sigma_tb -8.06
eps_r 0
eps_tb 0
X 0
D 4
K 3.29328
lambda -4.38974
C 0.877949
H -0.00372037
Y 1.05132
I -0.975418
phi -4.38974
r -3.91202

EIGENVALUES:
Modulus Real Imaginary

        0.94             0.94                0
        0.94             0.94                0
        0.95             0.95                0
        0.95             0.95                0
      0.9698           0.9693           0.0331
      0.9698           0.9693          -0.0331
        0.97             0.97                0
      0.9921           0.9921                0
       1.028            1.028                0
       1.052            1.051           0.0359
       1.052            1.051          -0.0359
   2.901e+16        2.901e+16                0

There are 4 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)

The rank condition is verified.

MODEL SUMMARY

Number of variables: 14
Number of stochastic shocks: 5
Number of state variables: 8
Number of jumpers: 4
Number of static variables: 3

MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS

Variables u_sigma_r u_sigma_tb u_r u_tb u_x
u_sigma_r 1.000000 0.000000 0.000000 0.000000 0.000000
u_sigma_tb 0.000000 1.000000 0.000000 0.000000 0.000000
u_r 0.000000 0.000000 1.000000 0.000000 0.000000
u_tb 0.000000 0.000000 0.000000 1.000000 0.000000
u_x 0.000000 0.000000 0.000000 0.000000 1.000000

ans =

2.8304e-10

Total computing time : 0h00m04s

Is it reasonable??

Thank you so much!!

If you set

irf=0

in stoch_simul, you are suppressing the IRFs. You need to set it higher. Also note that Dynare does not support the IRFs from the EMAS, but only GIRFS. You will need to increase the replications.

[quote=“jpfeifer”]If you set

irf=0

in stoch_simul, you are suppressing the IRFs. You need to set it higher. Also note that Dynare does not support the IRFs from the EMAS, but only GIRFS. You will need to increase the replications.[/quote]

Thank you! Jpfeifer! It helps a lot!^^

There is a page about this study in the ReplicationWiki, could you contribute to it?
replication.uni-goettingen.de/wiki/index.php/Risk_Matters:The_Real_Effects_of_Volatility_Shocks(AER_2011)

We added the study to the replication wiki. Moreover, replication code is now available at my homepage: sites.google.com/site/pfeiferecon/research

I have a similar question, why does the replication of this paper by Villaverde would create a colinear equation?
I also want to replicate some similar international paper with order 2, and I get the same error with colinear equation.
Is it a bug in mod file or limitation of dynare?

As I said, the mod-file of the original poster is wrong. The correct one available in the replication files to Born/Pfeifer (2014): “Risk Matters: A comment” at sites.google.com/site/pfeiferecon/20140525_replication_codes.zip?attredirects=0 does not have a collinearity issue.