Programs

 C.1 Eviews time series simulation
The following Eviews program generates the simulations in Figures B.1a-.1f.
wfcreate arsim u 1 101
scalar nobs = @obssmpl
scalar nobs1 = nobs-1
scalar rho = -1.05
scalar sig = 1.0
scalar y0 = 0
scalar cons = 0.0
genr eps = sig*nrnd
series y = y0
for !i = 2 to nobs
y(!i) = cons + rho*y(!i-1) + eps(!i)
next
line y

C.2 Dynare simulation of the small macro model
The following Dynare program generates impulse response graphs for the small macro model in
Section 5.3.
var y, pi, r, u, v;
varexo e, g;
parameters a, bpi, by, c, ybar, pibar, rbar, rho, phi;
bpi = 0.5;
by = 0.5;
a = 2.0;
c = 0.4;
pibar = 2.0;
ybar = 3.0;
rbar = 0.0;
rho = 0.0;
phi = 0.0;
model;
y = ybar + a*(pi - Expectation(-1)(pi(0))) + v;
y = ybar - c*r + u;
r= rbar + bpi*(pi - pibar) + by*(y - ybar);
u = rho*u(-1) + e;
v = phi*v(-1) + g;
end;
initval;
y = 2.0;
r = 1.0;
pi = 2.0;
v = 0;
u = 0;
end;
shocks;
var e; stderr 0.0;
var g; stderr 1.0;
end;
stoch simul(irf=10);

C.3 Matlab simulation of the climate model
The following program simulates the climate model in Chapter 13 used to create Table 1.
tmax=203;
delta=0.1;
deltaA=0.01;
deltaL=0.052;
deltasig=-0.0002;
gL0=0.023;
gA0=0.015;
gsig0=-0.01;
theta1=0.002; theta2=2.0;
beta=0.0018;
C0=500;
alpha=0.3;
s=0.25;
rho=0.01;
eta=1.5;
D0=1/(1+(theta1*((beta*C0) symbol94theta2)));
L=6.838*ones(1,tmax);
A=5*ones(1,tmax);
k=ones(1,tmax);
y=13.5*ones(1,tmax);
ybau=13.5*ones(1,tmax);
D=D0*ones(1,tmax);
T=500*zeros(1,tmax);
E=35*ones(1,tmax);
Esum=zeros(1,tmax);
sig=0.35*ones(1,tmax);
gL=gL0*ones(1,tmax);
gA=gA0*ones(1,tmax);
gsig=gsig0*ones(1,tmax);
SCCt=zeros(1,tmax);
Date=2009*ones(1,tmax);
SCC=0;
t=1;
while t¡=tmax-1
gL(t+1)=gL0*(1+deltaL)ˆ(-t);
gA(t+1)=gA0*(1+deltaA) ymbol94(-t);
gsig(t+1)=gsig0*(1+deltasig)ˆ(-t);
L(t+1)=L(t)*(1+gL(t+1));
A(t+1)=A(t)*(1+gA(t+1));
sig(t+1)=sig(t)*(1+gsig(t+1));
k(t+1)=k(t)*(1-delta-gL(t)) + s*y(t);
y(t+1)=A(t+1)*(s*A(t+1)/(delta+gL(t+1)))ˆ(alpha/(1-alpha));
T(t+1)=beta*(C0+Esum(t));
D(t+1)=1/(1+0.2*theta1*(T(t)ˆtheta2));
ybau(t+1)=D(t+1)*A(t+1)*((s*(D(t+1)*A(t+1))/(delta+gL(t+1))) symbol94(alpha/(1-alpha)));
E(t+1)=sig(t+1)*y(t+1)*L(t+1);
Esum(t+1)=Esum(t)+E(t+1);
SCCt(t+1)=
(((1+rho)ˆ-(t+1))/(1-eta))*(((s*y(t+1)*L(t+1)) symbol94(1-
eta))-((s*ybau(t+1)*L(t+1))ˆ(1-eta)));
SCC = SCC + SCCt(t+1);
Date(t+1)=Date(t)+1;
t=t+1;
end
SCC

C.4 Dynare Simulation of the Ramsey Model
The programs below are for simulation of the model in Section 16.4. They are modified versions of a
program found in Juillard and Villemot (2009). The following simulates the model with a stochastic
shock to productivity Ã.
C.4.1 Stochastic Model
var y, c, k, a, h, b;
varexo e, u;
parameters beta, rhoa, rhob, alpha, delta, theta, psi, tau;
alpha = 0.36;
rhoa = 0.8;
rhob = 0.0;
tau = 0.0;
beta = 0.95;
delta = 0.025;
psi = 0.5;
theta = 2.95;
phi = 0.0;
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 = rhoa*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rhob*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.1;
var u; stderr 0.1;
var e, u = phi*0.1*0.1;
end;
stoch simul(irf=20,drop=5);
subplot(2,2,1); plot(a e(1:20),’LineWidth’,2);
title(’a’,”fontsize”,16);
subplot(2,2,2); plot(y e(1:20),’LineWidth’,2);
title(’y’,”fontsize”,16);
subplot(2,2,3); plot(k e(1:20),’LineWidth’,2);
title(’k’,”fontsize”,16);
subplot(2,2,4); plot(c e(1:20),’LineWidth’,2);
title(’c’,”fontsize”,16);

C.4.2 Deterministic shift in the discount factor
var y, c, k, h;
varexo z;
parameters beta, alpha, delta, theta, psi;
alpha = 0.36;
beta = 0.97;
delta = 0.025;
psi = 0.03;
theta = 2.95;
phi = 0.1;
model;
c*theta*hˆ(1+psi)=(1-alpha)*y;
k = alpha*y/(1-(beta+z)*(1-delta)*(c/c(+1)));
y = (k(-1)ˆalpha)*(hˆ(1-alpha));
k = y-c+(1-delta)*k(-1);
end;
initval;
y = 0.8;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
z = 0.0;
end;
steady;
endval;
z=0.02;
end;
steady;
perfect foresight setup(periods=500);
perfect foresight solver;
shock=oo .exo simul
subplot(2,2,1); plot(beta+shock(1:50),’LineWidth’,2);
title(‘eta’,”fontsize”,16);
axis([1,nobs,0.95,1.01]);
subplot(2,2,2); plot(y(1:50),’LineWidth’,2);
title(’y’,”fontsize”,16);
subplot(2,2,3); plot(k(1:50),’LineWidth’,2);
title(’k’,”fontsize”,16);
subplot(2,2,4); plot(c(1:50),’LineWidth’,2);
title(’c’,”fontsize”,16);

C.4.3 Pandemic Model
The following simulates a deterministic shift in θ (η in the text) to represent the fall in labor supply
from a pandemic.
var y, c, k, h;
varexo z;
parameters beta, alpha, delta, theta, psi;
alpha = 0.36;
beta = 0.97;
delta = 0.025;
psi = 0.03;
theta = 2.95;
phi = 0.1;
model;
c*(theta+z)*hˆ(1+psi)=(1-alpha)*y;
k = alpha*y/(1-(beta)*(1-delta)*(c/c(+1)));
y = (k(-1)ˆalpha)*(hˆ(1-alpha));
k = y-c+(1-delta)*k(-1);
end;
initval;
y = 0.8;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
z = 0.0;
end;
steady;
shocks;
var z;
periods 1:5;
values 1.0;
end;
perfect foresight setup(periods=500);
perfect foresight solver;
shock=oo .exo simul;
subplot(2,2,1); plot(theta+shock(1:50),’LineWidth’,2);
title(‘eta’,”fontsize”,16);
axis([1,50,2.5,4.5]);
subplot(2,2,2); plot(y(1:50),’LineWidth’,2);
title(’y’,”fontsize”,16);
subplot(2,2,3); plot(k(1:50),’LineWidth’,2);
title(’k’,”fontsize”,16);
subplot(2,2,4); plot(c(1:50),’LineWidth’,2);
title(’c’,”fontsize”,16);

Popular Posts