Macroprocessor question
Posted: Sun Nov 03, 2013 9:47 am
Dear all,
thank you in advance for your answers.
I have one mod file and inside I have a loop (@#for /@#endfor) framing my estimation and stoch simul commands.
It works very well.
Now, I would like to add another loop, with the same incrementation as my previous loop around estim/simul commands (hereafter I call it "pas"), in the parameter block.
It does not work
How could I do it this ?
Here is the code:
close all;
var y, pi, r, yf, ep, ei, at;
varexo up, ui, ua;
parameters alpha beta teta sigma neta epsilon li1 li2 li3 rhoa rhop rhoi pb yb rb;
@#for pas in 1:49
load nyc1@{pas};
@#endfor
alpha = 0.33;
beta = 0.99;
teta = 0.66;
sigma = 2.0;
neta = 1.0;
epsilon = 6.0;
li1 = 0.50;
li2 = 2.5;
li3 = 0.5;
rhoa = 0.75;
rhop = 0.75;
rhoi = 0.50;
rhom = 0.75;
set_param_value('pb',tr)
yb = 0;
rb = 0;
model;
yf = ((1+neta)/(sigma*(1-alpha)+neta+alpha))*at + ((1-alpha)*(-(log((1+(1/((1/(epsilon-1)))))/((1+(1/((1/(epsilon-1)))))-1))))/(sigma*(1-alpha)+neta+alpha));
pi = beta*pi(+1)+((1-teta)*(1-beta*teta)*(sigma*(1-alpha)+neta+alpha)/(teta*(1-alpha+alpha*(1+(1/((1/(epsilon-1))+ep))))))*(y-yf);
y = y(+1)-(1/sigma)*(r-rb-pi(+1));
r-rb = (1-li1)*(li2*(pi-pb) + li3*(y-yf)) + li1*(r(-1)-rb) + ei;
at = rhoa * at(-1) + ua;
ep = rhop * ep(-1) + up;
ei = rhoi * ei(-1) + ui;
end;
steady;
check;
shocks;
var ua = 0.01;
var ui = 0.01;
var up = 0.01;
end;
estimated_params;
alpha, beta_pdf, 0.33, 0.05;
teta, beta_pdf, 0.66, 0.05;
sigma, normal_pdf, 2.0, 0.05;
neta, normal_pdf, 1.0, 0.1;
epsilon, normal_pdf, 6.0, 0.1;
li1, beta_pdf, 0.5, 0.25;
li2, normal_pdf, 2.5, 0.25;
li3, normal_pdf, 0.5, 0.25;
rhoa, beta_pdf, 0.75, 0.1;
rhop, beta_pdf, 0.75, 0.1;
rhoi, beta_pdf, 0.50, 0.1;
stderr ua, inv_gamma_pdf, 0.01, 2;
stderr ui, inv_gamma_pdf, 0.01, 2;
stderr up, inv_gamma_pdf, 0.01, 2;
end;
varobs pi y r;
@#for pas in 1:49
estimation(nograph,nodisplay,order=1,datafile=nyc1@{pas},filter_step_ahead=[1:12],mode_compute=4,bayesian_irf,forecast=12,mh_jscale=0.6,mh_replic=6000,mh_nblocks=2) pi y r yf;
stoch_simul(nograph,nodisplay,order=2,irf=40,conditional_variance_decomposition=[1 4 40]);
close all;
oobase@{pas}_=oo_;
save base@{pas}_oo oobase@{pas}_
close all;
@#endfor
Best,
Jonathan
thank you in advance for your answers.
I have one mod file and inside I have a loop (@#for /@#endfor) framing my estimation and stoch simul commands.
It works very well.
Now, I would like to add another loop, with the same incrementation as my previous loop around estim/simul commands (hereafter I call it "pas"), in the parameter block.
It does not work
How could I do it this ?
Here is the code:
close all;
var y, pi, r, yf, ep, ei, at;
varexo up, ui, ua;
parameters alpha beta teta sigma neta epsilon li1 li2 li3 rhoa rhop rhoi pb yb rb;
@#for pas in 1:49
load nyc1@{pas};
@#endfor
alpha = 0.33;
beta = 0.99;
teta = 0.66;
sigma = 2.0;
neta = 1.0;
epsilon = 6.0;
li1 = 0.50;
li2 = 2.5;
li3 = 0.5;
rhoa = 0.75;
rhop = 0.75;
rhoi = 0.50;
rhom = 0.75;
set_param_value('pb',tr)
yb = 0;
rb = 0;
model;
yf = ((1+neta)/(sigma*(1-alpha)+neta+alpha))*at + ((1-alpha)*(-(log((1+(1/((1/(epsilon-1)))))/((1+(1/((1/(epsilon-1)))))-1))))/(sigma*(1-alpha)+neta+alpha));
pi = beta*pi(+1)+((1-teta)*(1-beta*teta)*(sigma*(1-alpha)+neta+alpha)/(teta*(1-alpha+alpha*(1+(1/((1/(epsilon-1))+ep))))))*(y-yf);
y = y(+1)-(1/sigma)*(r-rb-pi(+1));
r-rb = (1-li1)*(li2*(pi-pb) + li3*(y-yf)) + li1*(r(-1)-rb) + ei;
at = rhoa * at(-1) + ua;
ep = rhop * ep(-1) + up;
ei = rhoi * ei(-1) + ui;
end;
steady;
check;
shocks;
var ua = 0.01;
var ui = 0.01;
var up = 0.01;
end;
estimated_params;
alpha, beta_pdf, 0.33, 0.05;
teta, beta_pdf, 0.66, 0.05;
sigma, normal_pdf, 2.0, 0.05;
neta, normal_pdf, 1.0, 0.1;
epsilon, normal_pdf, 6.0, 0.1;
li1, beta_pdf, 0.5, 0.25;
li2, normal_pdf, 2.5, 0.25;
li3, normal_pdf, 0.5, 0.25;
rhoa, beta_pdf, 0.75, 0.1;
rhop, beta_pdf, 0.75, 0.1;
rhoi, beta_pdf, 0.50, 0.1;
stderr ua, inv_gamma_pdf, 0.01, 2;
stderr ui, inv_gamma_pdf, 0.01, 2;
stderr up, inv_gamma_pdf, 0.01, 2;
end;
varobs pi y r;
@#for pas in 1:49
estimation(nograph,nodisplay,order=1,datafile=nyc1@{pas},filter_step_ahead=[1:12],mode_compute=4,bayesian_irf,forecast=12,mh_jscale=0.6,mh_replic=6000,mh_nblocks=2) pi y r yf;
stoch_simul(nograph,nodisplay,order=2,irf=40,conditional_variance_decomposition=[1 4 40]);
close all;
oobase@{pas}_=oo_;
save base@{pas}_oo oobase@{pas}_
close all;
@#endfor
Best,
Jonathan