%BENCHSIM   Plot simulations generated by bench.f90.  See details about
%           model economy in the Fortran code.

%           Ellen McGrattan, 12-01-01
%           Revised, ERM, 1-5-05

load bench.dat
load ../mleannual/uszvar1.dat
grate  = 1.016.^([0:99]');
nipal  = uszvar1./[ones(100,1),grate,grate,ones(100,1),grate,grate];
s      = bench(:,1);
t0     = 1929;
t1     = t0-1+length(s);
t      = [t0:t1]';
tby    = find(t==t0);
nipa   = nipal(29:100,:);
kk(1)  = nipa(1,6);
for i=2:12;
  kk(i) = ((1-.0464)*kk(i-1)+nipa(i-1,3))/(1+.016)/(1.015);
end;
tk = t0:t0+11;

k      = bench(:,2);
cp     = bench(:,3);
hr     = bench(:,4);
ip     = bench(:,5);
gnp    = bench(:,6);
w      = bench(:,7);
r      = bench(:,8);
g      = bench(:,9);
taul   = bench(:,10);
tauk   = bench(:,11);
tauc   = bench(:,12);
taux   = bench(:,13);
z      = bench(:,14);
GNP    = gnp(tby);

wedges = [(z/z(1)).^(.65),(1-taul)/(1-taul(1)),(1+taux(1))* ...
           ones(length(t),1)./(1+taux)];
figure(1)
  plot(t,wedges*100,nipa(:,1),nipa(:,2)*100,'k-.')
  axis([t0,t0+10,60,120])

figure(2)
  plot(t,gnp,'k-', t,cp, 'b-', t,ip, 'r-', t,g,  'g-', ...
       nipa(:,1),nipa(:,2),'k-.', ...
       nipa(:,1),nipa(:,2)-nipa(:,3)-nipa(:,5),'b-.', ...
       nipa(:,1),nipa(:,3),'r-.', ...
       nipa(:,1),nipa(:,5),'g-.');
  title('Real, Per-Capita, Detrended GNP and its Components   ')
  legend('GNP','Private Consumption', ...
         'Private Investment','Government Purchases')
  axis([t0,t0+10,-.2,1.2])

figure(3)
  plot(t,k,'k-',nipa(:,1),nipa(:,6),'k-.',tk,kk,'r-')
  title('Real, Per-Capita, Detrended Capital Stock ')
  axis([t0,t0+10,2,5])
  text(1930,2.1,'Red line = derived from NIPA x')

figure(4)
  plot(t,hr,'k-',nipa(:,1),nipa(:,4),'k-.')
  title('Hours per Working Age Person  ')
  if (t0==1929); 
    axis([t0,t0+10,0,.5])
  else;
    axis([t0,t0+10,0.15,.35])
  end;


disp('Output and Wedges')
[t(1:12),[nipa(1:12,2),wedges(1:12,:)]*100]
disp('Model GNP, Hours, Investment')
[t(1:12),[gnp(1:12)/gnp(1),hr(1:12)/hr(1),ip(1:12)]*100]
disp('Data GNP, Hours, Investment')
[nipa(1:12,1),[nipa(1:12,2),nipa(1:12,4)/nipa(1,4),nipa(1:12,3)]*100]

