Page 1 of 1

Reading and Interpreting Binary Output From Simulation

PostPosted: Thu Jul 30, 2015 3:24 pm
by yinx
Hi All,
I am trying to compute moments for a model using averages of simulated series. So, I have used the "simul_replic=1000" option to generate artificial 1000 economies, which has been saved into "FILENAME_simul" and have also used the "periods=164" option so as to have 64 periods that matches my data periods after dynare may have dropped the first 100 points.
I have tried to read the simulated series using the fread function in MATLAB that I read about elsewhere in this forum, but the data is read in nX1 size. The problem is that the number of rows is much greater than the number of variables multiplied by the number of periods and simulations asked for. Hence, I don't know how to apportion nX1 vector of simulated series to the relevant variables and compute my moments.
Can someone please help with this?
Thanks.
Yinka

Re: Reading and Interpreting Binary Output From Simulation

PostPosted: Thu Jul 30, 2015 3:47 pm
by jpfeifer
Please use the get_simul_replications-file from my homepage.

Re: Reading and Interpreting Binary Output From Simulation

PostPosted: Thu Jul 30, 2015 5:39 pm
by yinx
Thank you very much.

Re: Reading and Interpreting Binary Output From Simulation

PostPosted: Thu Jul 30, 2015 5:49 pm
by yinx
Hi,
Do you have an example of where you have used this function please? Thanks.
Yinka

Re: Reading and Interpreting Binary Output From Simulation

PostPosted: Fri Jul 31, 2015 11:38 am
by jpfeifer
An example would be
Code: Select all
var y, c, k, a, h, b;
varexo e, u;

parameters beta, rho, alpha, delta, theta, psi, tau;

alpha = 0.36;
rho   = 0.95;
tau   = 0.025;
beta  = 0.99;
delta = 0.025;
psi   = 0;
theta = 2.95;

phi   = 0.1;

model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;

initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
a = 0;
b = 0;
e = 0;
u = 0;                                         
end;

shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;

stoch_simul(order=1,periods=5200,simul_replic=100);
[sim_array]=get_simul_replications(M_,options_);

y_sim=squeeze(sim_array(strmatch('y',M_.endo_names,'exact'),:,:));

Re: Reading and Interpreting Binary Output From Simulation

PostPosted: Sat Aug 01, 2015 3:41 pm
by yinx
Thank you very much.
Yinka