Displaying and plotting exogenous variables
Posted: Wed Feb 06, 2013 3:44 am
Hi I have a very simple question. I am new to Dynare and replicating the example given in practicing Dynare (Barillas et. al) showing the impact of an increase in government spending (Chapter 11 RMT). I basically tried to run the code that was given in Sargent's website and could not get it to run. I have finally managed to get it to work but cannot dislay or extract the exogenous variable g. The example keeps referring to g as ex_(:,1), but Dynare does not allow me to display it. The code is given below,
Could you please help me with displaying the exogenous shock g. I tried rplot ex_(:,4) as it is the fourth exogenous variable.
Thanks
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent.
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 1:9;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
rplot c;
rplot plot ex_(:,4) ;
Could you please help me with displaying the exogenous shock g. I tried rplot ex_(:,4) as it is the fourth exogenous variable.
Thanks
// This program replicates figure 11.3.1 from chapter 11 of RMT2 by Ljungqvist and Sargent.
var c k;
varexo taui tauc tauk g;
parameters bet gam del alpha A;
bet=.95;
gam=2;
del=.2;
alpha=.33;
A=1;
model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
end;
initval;
k=1.5;
c=0.6;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;
endval;
k=1.5;
c=0.4;
g =.4;
tauc =0;
taui =0;
tauk =0;
end;
steady;
shocks;
var g;
periods 1:9;
values 0.2;
end;
simul(periods=100);
co=ys0_(var_index('c'));
ko = ys0_(var_index('k'));
go = ex_(1,1);
rbig0=1/bet;
rbig=y_(var_index('c'),2:101).^(-gam)./(bet*y_(var_index('c'),3:102).^(-gam));
rq0=alpha*A*ko^(alpha-1);
rq=alpha*A*y_(var_index('k'),1:100).^(alpha-1);
wq0=A*ko^alpha-ko*alpha*A*ko^(alpha-1);
wq=A*y_(var_index('k'),1:100).^alpha-y_(var_index('k'),1:100).*alpha*A.*y_(var_index('k'),1:100).^(alpha-1);
sq0=(1-ex_(1,4))*A*alpha*ko^(alpha-1)+(1-del);
sq=(1-ex_(1:100,4)')*A*alpha.*y_(var_index('k'),1:100).^(alpha-1)+(1-del);
rplot c;
rplot plot ex_(:,4) ;