NaN's after using simulation

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

NaN's after using simulation

Postby Daniel Bendel » Fri Mar 27, 2015 10:55 am

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
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby jpfeifer » Fri Mar 27, 2015 1:48 pm

As always, provide a file to replicate the issue.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby Daniel Bendel » Fri Mar 27, 2015 2:43 pm

Here is the file.
Last edited by Daniel Bendel on Sat Mar 28, 2015 4:10 pm, edited 1 time in total.
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby Daniel Bendel » Fri Mar 27, 2015 3:07 pm

Interestingly, when using a second order approximation the monents are calculated when using a simulation...
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby jpfeifer » Fri Mar 27, 2015 4:18 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby Daniel Bendel » Fri Mar 27, 2015 4:46 pm

But why are there no NaN when I use the approximation of order 2 ?
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: NaN's after using simulation

Postby jpfeifer » Fri Mar 27, 2015 5:33 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests