Page 1 of 1

NaN's after using simulation

PostPosted: Fri Mar 27, 2015 10:55 am
by Daniel Bendel
Dear Dynare Users,

I have a strange problem. When I use stoch_simul(periods=0,irf=0,order=1) I got for every variable in my model their theoretical moments. But when I use a simulation of the model by setting stoch_simul(periods=1000,irf=0,order=1) some of my variables' moments display NaN.

Why?

Greetings,
Daniel

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 1:48 pm
by jpfeifer
As always, provide a file to replicate the issue.

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 2:43 pm
by Daniel Bendel
Here is the file.

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 3:07 pm
by Daniel Bendel
Interestingly, when using a second order approximation the monents are calculated when using a simulation...

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 4:18 pm
by jpfeifer
When you specify the periods statement, Dynare computes simulated moments. For variables that are constant, you can compute the mean and the variance. The latter will be 0. But for the other moments, there is a problem. Take the auto or cross-correlation. It is covariance divided by the standard deviations. But if both are 0 as is the case for constant variables, the result is NaN.
In contrast, for theoretical moments, Dynare knows that the variables are constant and correctly computes these moments to be 0.

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 4:46 pm
by Daniel Bendel
But why are there no NaN when I use the approximation of order 2 ?

Re: NaN's after using simulation

PostPosted: Fri Mar 27, 2015 5:33 pm
by jpfeifer
Because at order=2 the variables that were constant at order=1 are not constant anymore. Hence, you can compute the moments. The reason for this must be in your model and is a matter of economic intuition.