# Reading and Interpreting Binary Output From Simulation

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.
Thanks.
Yinka

Please use the get_simul_replications-file from my homepage.

Thank you very much.

Hi,
Do you have an example of where you have used this function please? Thanks.
Yinka

An example would be

[code]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;
cthetah^(1+psi)=(1-alpha)y;
k = beta
(((exp(b)c)/(exp(b(+1))c(+1)))
(exp(b(+1))alphay(+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 = taua(-1)+rhob(-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 = phi0.0090.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’),:,:));
[/code]

Thank you very much.
Yinka