Page 1 of 1

Laplace Approximation =minus infinity and inaccurate result

PostPosted: Thu Nov 13, 2014 9:23 pm
by aadegboye abiodun
Dear Dynare friends/helpers,
I run the attached codes on Dynare 4.4.2 and got some teribble error message. it reads

'' Matrix is singular to working precision
Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND=NaN ...

The log data density is negative infinity.

A guide on what steps to take would be helpful. Someone should kindly assist.

Here is my model codes

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Fri Nov 14, 2014 9:19 am
by jpfeifer
There is no datafile

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Fri Nov 14, 2014 8:45 pm
by aadegboye abiodun
Dear jpfeifer,

I HAVE JUST ATTACHED THE DATAFILE AS REQUESTED. YOUR EFFORT IS APPRECIATED.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Fri Nov 14, 2014 9:08 pm
by aadegboye abiodun
hi,
I try to attach the datafile again

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Sat Nov 15, 2014 7:46 am
by jpfeifer
Before looking at the Laplace, try fixing the other issues with your model first. For example:
1. You are neglecting the parameter dependence in your estimation. You need to set hpid and mpif in each iteration, because you are estimating gamad. Define them as model-local variables. See Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf for more information.

2. Plot your data. y seems to have a massive seasonal pattern at the end. You need to deal with seasonal adjustment before estimation. See again Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf for more information.

3. Similarly, amp looks like a step function. Fitting a continuous AR-process to this most probably won't work.

4. Check identification. You have
==== Identification analysis ====

Testing prior mean
Evaluating simulated moment uncertainty ... please wait
Doing 402 replicas of length 300 periods.
Simulated moment uncertainty ... done!

WARNING !!!
The rank of H (model) is deficient!

phigy is not identified in the model!
[dJ/d(phigy)=0 for all tau elements in the model solution!]

You estimate phigy but it does not appear in any equation.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Mon Nov 17, 2014 9:12 pm
by aadegboye abiodun
Dear jpfeifer,
Your effort is appreciated. Kindly guide on the following.
1. how to use one sided HP filter
2. is AR(1) process suggesting a stationarity in my model e.g. in log A= rho (log A) + eps_a? I treat it as a stationary factor in my model. I'm I right? Kindly guide.
I appreciate your effort in guiding me.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Wed Nov 19, 2014 5:08 pm
by jpfeifer
1. See https://ideas.repec.org/c/dge/qmrbcd/181.html
2. An AR-process in Dynare is both continuous (no discrete jumps) and mean-reverting. The step function in one of your observables where the variables stays constant for a long time and then jumps seems to contradict this and might lead to problems.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Sun Nov 30, 2014 11:16 am
by aadegboye abiodun
dear jpfeifer,

I HAVE FOUND YOUR GUIDE BEFORE NOW VERY HELPFUL.
I have removed trend and seasonality from my data. I use one sided hp filter as suggested in your paper, ' GUIDE TO SPECIFYING OBSERVATION EQUATIONS'. FOR THE MODEL I HAVE EXPRESSED THE PARAMETERS DIRECTLY. HOWEVER THE RESULTS IS YET TO COME OUT. THE ERRORS ....MATRIX IS BADLY SCALED, SINGULAR ETC STILL SHOWS.
MY MODEL CODES AND DATAFILE ARE ATTACHED. I SHOULD BE GLAD TO RECEIVE FURTHER GUIDE ON HOW TO MOVE FORWARD. KINDLY ASSIST WITH GUIDE TO GET MY MODEL CODE RUN.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Tue Dec 02, 2014 8:22 pm
by aadegboye abiodun
Dear jpfeifer,
I should be glad to receive some guide as earlier requested in my post on the subject.

Re: Laplace Approximation =minus infinity and inaccurate res

PostPosted: Wed Dec 03, 2014 10:29 am
by jpfeifer
Add
Code: Select all
estimated_params_init(use_calibration);
end;

before estimation. Then follow the error messages. For example
Cannot use parameter values from calibration as they violate the prior bounds.Error using check_prior_bounds (line 39)
Initial value(s) of comega, aeta, phidebt, phigove, aystab, exrstab are outside parameter bounds. Potentially, you should set prior_trunc=0. If you used the
mode_file-option, check whether your mode-file is consistent with the priors.

If you look at comega, your calibrated value is 0.8 but your prior mean is 0.7 with a standard error of 0.01 only. Essentially you are saying, the 0.8 you calibrated your model to will never happen.