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

As always, provide a file to replicate the issue.

Interestingly, when using a second order approximation the monents are calculated when using a simulation…

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.

But why are there no NaN when I use the approximation of order 2 ?

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.