Page 1 of 1

Solver matrix (close to) singular: how to troubleshoot

PostPosted: Tue Dec 06, 2016 8:54 pm
by ryoanji
I am new to Dynare and have been very impressed with its capabilities. At the moment, I am trying to replicate the results in Aoki Benigno Kiyotaki (2016) Monetary and Financial Policies in EMEs working paper. Since I am still learning a lot, I decided to go slow: from simple to more complex. I am trying to replicate the basic closed economy model in their set-up, then add sticky prices, then open up the economy, then add "bankers." I am fine with former, but when I add Rotemberg's sticky prices equations, I am running into a lot of problems.

1. Steady state solver reaches maxit and fails to converge.
Impossible to find the steady state. Either the model doesn't have a steady state, there are an infinity of steady states,
or the guess values are too far from the solution

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


2. When I specify steady_state_model, everything goes throw but I get a warning:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.653498e-20.

and IRFs are explosive
stoch_simul:: The simulations conducted for generating IRFs to eA were explosive.
stoch_simul:: No IRFs will be displayed. Either reduce the shock size,
stoch_simul:: use pruning, or set the approximation order to 1.


that is with second order perturbation, when I drop the order to 1, I get matrix singularity
One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is smaller than 1e-06!
If you believe that the model has a unique solution you can try to reduce the value of qz_zero_threshold.



How would suggest me to troubleshoot this? What I am doing appears to be quite standards and I am just replicating paper. I don't thing it is just the model's steady state that is problematic here.

Thank you so much in advance for your help. I hope that with time, I could contribute to this great forum as well!

p.s. here is the link to the paper:
https://www.princeton.edu/~kiyotaki/pap ... 4-2016.pdf

Re: Solver matrix (close to) singular: how to troubleshoot

PostPosted: Fri Dec 09, 2016 9:36 am
by jpfeifer
Hi,
there must be fundamental singularity problem in your model. You can forget about all other problems, they are just symptoms. If you run model_diagnostics, you get
Code: Select all
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:
L
w
Y
C
K
I
mc
pi
Colinear equations
     1     5     6     7
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.

Focus on those equations.

Re: Solver matrix (close to) singular: how to troubleshoot

PostPosted: Tue Feb 14, 2017 5:22 pm
by alex2836
Hi ryoanji,
I looked at your code. I think you need to specify a monetary policy rule to pin down "pi", in addition to the NKPC. See the last equation in the paper. Right now, I can combine your equation 6 and 7 together and make the system with more endogenous variables than equations (i.e. 11 endo var versus 10 non-redundant equations). I think this is where your singularity problem coming from.
Hope this helps.