%  hschap5.m
%  generates an asset pricing example for chapter 5 (hsch5) of book2
%  The example is a Lucas asset pricing model
!rm hsch51.met
!rm hsch52.met
!rm hsch53.met
!rm hsch54.met
!rm hsch55.met
!rm hsch56.met
clex14
t1=100;
nt=t1;
solvea
sy=sc;
asimul
pay=sd(1,:)
asseta
riskpr
v2
plot(y(:,3))
meta hsch55
!gpp -dps hsch55
r1=R1(2:nt).^(-1);r1=r1';
RR=[y(:,4) r1];

plot(RR)
meta hsch51
!gpp -dps hsch51
corrcoef(RR)

r5=R5(2:nt).^(-1);r5=r5';

r2=R2(2:nt).^(-1);r2=r2';

lr1=log(r1);
lr2=log(r2)./2;
lr5=log(r5)./5;
lr=[lr1 lr2 lr5];
plot(lr)
lr=[lr1 lr5];
plot(lr)
meta hsch52
!gpp -dps hsch52

%%%%%%   
%%%   Now let's reset a22(2,2) and recompute
a22(2,2)=.4;
solvea
sy=sc;
asimul
pay=sd(1,:)
asseta
riskpr
v2
plot(y(:,3))
meta hsch56
!gpp -dps hsch56

r1=R1(2:nt).^(-1);r1=r1';
RR=[y(:,4) r1];

plot(RR)
meta hsch53
!gpp -dps hsch53
corrcoef(RR)

r5=R5(2:nt).^(-1);r5=r5';

r2=R2(2:nt).^(-1);r2=r2';

lr1=log(r1);
lr2=log(r2)./2;
lr5=log(r5)./5;
lr=[lr1 lr2 lr5];
plot(lr)
lr=[lr1 lr5];
plot(lr)
meta hsch54
!gpp -dps hsch54
