Page 1 of 1

Approximated theoretic moments NaN

PostPosted: Tue Sep 30, 2014 5:45 am
by superztt
I got some of variables' approximated theoretic moments NaN. What does this imply? Can I still trust the result, such as policy functions and simulations ?

Re: Approximated theoretic moments NaN

PostPosted: Tue Sep 30, 2014 6:00 am
by jpfeifer
You need to find out where the NaN come from. If they result from a unit root, everything should be fine (if the unit root is supposed to be in your model). You can see the eigenvalues using the check-command. If the result from a singularity due to a division by 0, there might be an issue.

Re: Approximated theoretic moments NaN

PostPosted: Wed Oct 01, 2014 9:08 pm
by superztt
Thank you, jpfeifer.

I found the model has both unit eigenvalue and a warning of "Matrix is close to singular".

The policy functions returned have finite numbers. However, the mean and variance in APROXIMATED THEORETICAL MOMENTS are NaN for some variables. I am confused. How are mean and variance derived? If it is the response to a s.d. of a shock, should mean be a the corresponding result of policy function and nor variance?

Re: Approximated theoretic moments NaN

PostPosted: Fri Oct 03, 2014 8:01 am
by jpfeifer
A first order solved DSGE model's solution has the form of a state space system. You can use this system to compute the unconditional mean and variance. See e.g. the book of Hamilton (1994): "Time Series Analysis". It has nothing to do with IRFs. If your model has a unit root, some variables will be NaN, because a random walk does not have finite first and second moments.

Re: Approximated theoretic moments NaN

PostPosted: Thu Nov 13, 2014 6:48 am
by superztt
I am confused about the relation between the distribution of shocks I give manually in the shock block, and the distribution of shocks in the state space. I don't think they are the same, are they?

Because I noticed the difference between the two, if I put the shock in the simulation to get the variance of it from APROXIMATED THEORETICAL MOMENTS. Nonetheless, I get non-zero variance in APROXIMATED THEORETICAL MOMENTS if and only if I specify a shock's variance in the shock block. So does it mean the state space will skip the shocks that do not appear in the shock block?

Re: Approximated theoretic moments NaN

PostPosted: Fri Nov 14, 2014 6:20 am
by jpfeifer
If a shock is not specified in the shocks block, its variance is set to 0 (the value it is initialized to). Without the shocks block, how should Dynare know this variance?

Re: Approximated theoretic moments NaN

PostPosted: Fri Nov 14, 2014 7:06 am
by superztt
Do you mean the variance of a shock in APROXIMATED THEORETICAL MOMENTS should be the same as I specified in the shock block, without some dynare internal imposition? Then it's weird I didn't get the consistency. Does it depend on the periods of IRFs I choose? Cheers!

Re: Approximated theoretic moments NaN

PostPosted: Fri Nov 14, 2014 9:26 am
by jpfeifer
Now I am confused. could it be that you are confusing shock variances and the variance of an exogenous process? Consider
Code: Select all
z=rho*z(-1)+epsilon

where
Code: Select all
shocks;
var epsilon 1;
end

In this case, the variance of z will be 1^2/(1-rho^2). This is the number Dynare would display as the theoretical variance for z. It will never display the moments for epsilon.