Time series 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.

Time series simulation!

Postby Glm » Fri Mar 27, 2015 9:44 am

I use the code below to generate time series in Dynare. My shock matrix "Model.Sigma_e" is iid, (diagonal). But when I use this code I don't get the same standard deviations for the observed variables. std_sim=std(Yt(DynareOptions.varobs_id,:)') is not equal to when I calculate the standard deviations after I run stoch_simul(order=1, periods=110000, nograph) dY dC dinvestment dW n_obs inflation R_fed

in Dynare. So I basically wonder how are the times series (more specifically) in Dynare created when using stochsimul?

YSS=DynareResults.dr.ys;
A=DynareResults.dr.ghx;
B=DynareResults.dr.ghu;
Yt(:,1)=YSS;
% shock_vec=zeros(size(B,2),1);
% shock_vec(2)=1;

klockan=clock;
randn('seed',klockan(end)*1000);
shock_mat=mvnrnd(zeros(size(Model.Sigma_e,1),1),sqrt(Model.Sigma_e),100000)';

for i=1:size(shock_mat,2)
Yt(DynareResults.dr.order_var,1+i)= YSS(DynareResults.dr.order_var) + A*(Yt(DynareResults.dr.state_var,i)-YSS(DynareResults.dr.state_var))+B*shock_mat(:,i);
end
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Time series simulation!

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

Please have a look at the simult_.m function used for this by Dynare.
------------
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: Google [Bot] and 10 guests