%MAKEFIGS  generates the figures in Appendix C of the Technical Appendix
%          (listed under Staff Report 407) to
%
%            Technology Capital and the US Current Account 
%            Staff Report 406, Minneapolis Federal Reserve
%            by Ellen McGrattan and Edward Prescott   
%
%          The code runs cases in nx_tcap.m/nx_tcap3.m and nx_std.m
%          and plots comparable results.
%

%          Ellen McGrattan, 2-1-08
%          Revised, ERM, 6-6-09


T     = 100;
Nrmax = 1.18;
Nr    = [linspace(1,Nrmax,38)';
         Nrmax+[.005;.008;.0099;.0103;.0099;.008;.005];
         linspace(Nrmax,1,38)';ones(30,1)];Nr=8*Nr(1:T);
Armax = 1.012;
Ar    = [linspace(1,Armax,38)';
         Armax+[.00023;.0004;.0005;.00055;.0005;.0004;.00023];
         linspace(Armax,1,38)';ones(30,1)];Ar=Ar(1:T);

Nr0   = Nr;
Nr(43:T)=Nr(42)*ones(T-42,1);
Ar0   = Ar;
Ar(43:T)=Ar(42)*ones(T-42,1);
t     = 1960:1959+T;


figure(11)
plot(t,Nr0,'Linewidth',2,'Color','k')
set(gca,'Fontsize',14,'Fontname','Times')

figure(12)
plot(t,Ar0,'Linewidth',2,'Color','k')
set(gca,'Fontsize',14,'Fontname','Times')

figure(21)
plot(t,Nr,'Linewidth',2,'Color','k')
set(gca,'Fontsize',14,'Fontname','Times')

figure(22)
plot(t,Ar,'Linewidth',2,'Color','k')
set(gca,'Fontsize',14,'Fontname','Times')

%
% Plot results for temporary change in ROW population
%

clc
disp('Next: choose case=1 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap 
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

nxdivgdp = NXu./GDPu*100;
pcgdpu   = GDPu./Nu*Nu(1)/GDPu(1)*100;
pcgdpr   = GDPr./Nr*Nr(1)/GDPr(1)*100;
labprdu  = prdu/prdu(1)*100;
labprdr  = prdr/prdr(1)*100;
cshru    = Cu./GDPu*100;
cshrr    = Cr./GDPr*100;
xshru    = Xu./GDPu*100;
xshrr    = Xr./GDPr*100;
xtcapu   = Xd./GDPu*100;

clc
disp('Next: choose case=1 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_std
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

figure(13)
load data.dat
plot(data(:,1),data(:,2),'Color','k','Marker','o')
line(t,NXu./GDPu*100,'Linewidth',2,'Color','r')
line(t,nxdivgdp,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1977,-2.4,'U.S. data','Fontsize',14,'Fontname','Times')
text(1976,1.45,'Model without technology capital', ...
     'Fontsize',14,'Fontname','Times')
text(1982,-5,'Model with technology capital', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,-8,4])

figure(14)
plot(t(1:5:T),pcgdpu(1:5:T),'bo', ...
     t(1:5:T),pcgdpr(1:5:T),'b^')
line(t,GDPu./Nu*Nu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Nr*Nr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,pcgdpu,'Linewidth',2,'Color','b')
line(t,pcgdpr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1974,100.3,'Model without technology capital, both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1968,96.8,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1978,102.9,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,94,104])

figure(15)
plot(t(1:5:T),labprdu(1:5:T),'bo', ...
     t(1:5:T),labprdr(1:5:T),'b^')
line(t,GDPu./Hu*Hu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Hr*Hr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,labprdu,'Linewidth',2,'Color','b')
line(t,labprdr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
set(gca,'YTick',99:104)
axis([1960,2010,99,104])
text(1977,100.6,'Model without technology capital, both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1965,99.9,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1975,102.5,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')


figure(16)
plot(t(1:5:T),cshru(1:5:T),'bo', ...
     t(1:5:T),cshrr(1:5:T),'b^')
line(t,Cu./GDPu*100,'Linewidth',2,'Color','r')
line(t,Cr./GDPr*100,'Linewidth',2,'Color','r')
line(t,cshru,'Linewidth',2,'Color','b')
line(t,cshrr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1987.5,84.8,'Model without technology capital,', ...
     'Fontsize',14,'Fontname','Times')
text(1987.5,84.3,'both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1975,88,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1980,81.8,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,80,90])

figure(17)
plot(t(1:5:T),xshru(1:5:T),'bo', ...
     t(1:5:T),xtcapu(1:5:T),'bs')
line(t,Xu./GDPu*100,'Linewidth',2,'Color','r')
line(t,xshru,'Linewidth',2,'Color','b')
line(t,xtcapu,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1966,17,'Model without technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,14.5,'Model with technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,4.5,'Model with technology capital, Technology share', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,2,20])


%
% Plot results for permanent change in ROW population
%

clc
disp('Next: choose case=2 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap 
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

nxdivgdp = NXu./GDPu*100;
pcgdpu   = GDPu./Nu*Nu(1)/GDPu(1)*100;
pcgdpr   = GDPr./Nr*Nr(1)/GDPr(1)*100;
labprdu  = prdu/prdu(1)*100;
labprdr  = prdr/prdr(1)*100;
cshru    = Cu./GDPu*100;
cshrr    = Cr./GDPr*100;
xshru    = Xu./GDPu*100;
xshrr    = Xr./GDPr*100;
xtcapu   = Xd./GDPu*100;

clc
disp('Next: choose case=2 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_std
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

figure(23)
plot(data(:,1),data(:,2),'Color','k','Marker','o')
line(t,NXu./GDPu*100,'Linewidth',2,'Color','r')
line(t,nxdivgdp,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1987.7,-3.2,'U.S. data','Fontsize',14,'Fontname','Times')
text(1976,1.3,'Model without technology capital', ...
     'Fontsize',14,'Fontname','Times')
text(1961,2.1,'Model with technology capital', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,-8,4])

figure(24)
plot(t(1:5:T),pcgdpu(1:5:T),'bo', ...
     t(1:5:T),pcgdpr(1:5:T),'b^')
line(t,GDPu./Nu*Nu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Nr*Nr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,pcgdpu,'Linewidth',2,'Color','b')
line(t,pcgdpr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1974,100.3,'Model without technology capital, both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1968,96.8,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1978,103,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,94,104])

figure(25)
plot(t(1:5:T),labprdu(1:5:T),'bo', ...
     t(1:5:T),labprdr(1:5:T),'b^')
line(t,GDPu./Hu*Hu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Hr*Hr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,labprdu,'Linewidth',2,'Color','b')
line(t,labprdr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
set(gca,'YTick',99:104)
axis([1960,2010,99,104])
text(1977,100.6,'Model without technology capital, both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1965,99.9,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1975,102.5,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')


figure(26)
plot(t(1:5:T),cshru(1:5:T),'bo', ...
     t(1:5:T),cshrr(1:5:T),'b^')
line(t,Cu./GDPu*100,'Linewidth',2,'Color','r')
line(t,Cr./GDPr*100,'Linewidth',2,'Color','r')
line(t,cshru,'Linewidth',2,'Color','b')
line(t,cshrr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1987,83.9,'Model without technology capital,', ...
     'Fontsize',14,'Fontname','Times')
text(1987,83.4,'both countries', ...
     'Fontsize',14,'Fontname','Times')
text(1975.5,88,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1980,81.8,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,80,90])

figure(27)
plot(t(1:5:T),xshru(1:5:T),'bo', ...
     t(1:5:T),xtcapu(1:5:T),'bs')
line(t,Xu./GDPu*100,'Linewidth',2,'Color','r')
line(t,xshru,'Linewidth',2,'Color','b')
line(t,xtcapu,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1966,17,'Model without technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,14.5,'Model with technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,4.5,'Model with technology capital, Technology share', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,2,20])


%
% Plot results for temporary change in ROW TFP 
%

clc
disp('Next: choose case=3 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap 
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

nxdivgdp = NXu./GDPu*100;
pcgdpu   = GDPu./Nu*Nu(1)/GDPu(1)*100;
pcgdpr   = GDPr./Nr*Nr(1)/GDPr(1)*100;
labprdu  = prdu/prdu(1)*100;
labprdr  = prdr/prdr(1)*100;
cshru    = Cu./GDPu*100;
cshrr    = Cr./GDPr*100;
xshru    = Xu./GDPu*100;
xshrr    = Xr./GDPr*100;
xtcapu   = Xd./GDPu*100;

clc
disp('Next: choose case=3 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_std
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

figure(33)
plot(data(:,1),data(:,2),'Color','k','Marker','o')
line(t,NXu./GDPu*100,'Linewidth',2,'Color','r')
line(t,nxdivgdp,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1995,-.5,'U.S. data','Fontsize',14,'Fontname','Times')
text(1961,-1,'Model without', ...
     'Fontsize',14,'Fontname','Times')
text(1961,-1.5,'technology capital', ...
     'Fontsize',14,'Fontname','Times')
text(1988,-3.5,'Model with', ...
     'Fontsize',14,'Fontname','Times')
text(1988,-4,'technology capital', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,-8,4])

figure(34)
plot(t(1:5:T),pcgdpu(1:5:T),'bo', ...
     t(1:5:T),pcgdpr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Nu(1:5:T)*Nu(1)/GDPu(1)*100,'ro', ...
     t(1:5:T),GDPr(1:5:T)./Nr(1:5:T)*Nr(1)/GDPr(1)*100,'r^')
line(t,GDPu./Nu*Nu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Nr*Nr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,pcgdpu,'Linewidth',2,'Color','b')
line(t,pcgdpr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1985,104,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,101.3,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,98.5,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1985,96,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,95,105])

figure(35)
plot(t(1:5:T),labprdu(1:5:T),'bo', ...
     t(1:5:T),labprdr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Hu(1:5:T)*Hu(1)/GDPu(1)*100,'ro', ...
     t(1:5:T),GDPr(1:5:T)./Hr(1:5:T)*Hr(1)/GDPr(1)*100,'r^')
line(t,GDPu./Hu*Hu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Hr*Hr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,labprdu,'Linewidth',2,'Color','b')
line(t,labprdr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
set(gca,'YTick',99:103)
axis([1960,2010,99,103])
text(1982,102,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,100.7,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1973,100.,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1973,99.55,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')


figure(36)
plot(t(1:5:T),cshru(1:5:T),'bo', ...
     t(1:5:T),cshrr(1:5:T),'b^', ...
     t(1:5:T),Cu(1:5:T)./GDPu(1:5:T)*100,'ro', ...
     t(1:5:T),Cr(1:5:T)./GDPr(1:5:T)*100,'r^')
line(t,Cu./GDPu*100,'Linewidth',2,'Color','r')
line(t,Cr./GDPr*100,'Linewidth',2,'Color','r')
line(t,cshru,'Linewidth',2,'Color','b')
line(t,cshrr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1983,88.3,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1984,85.4,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1984.6,83.5,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983.7,81.5,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,80,90])

figure(37)
plot(t(1:5:T),xshru(1:5:T),'bo', ...
     t(1:5:T),xtcapu(1:5:T),'bs')
line(t,Xu./GDPu*100,'Linewidth',2,'Color','r')
line(t,xshru,'Linewidth',2,'Color','b')
line(t,xtcapu,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1966,17,'Model without technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,14.5,'Model with technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,4.5,'Model with technology capital, Technology share', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,2,20])

%
% Plot results for permanent change in ROW TFP 
%

clc
disp('Next: choose case=4 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap 
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

nxdivgdp = NXu./GDPu*100;
pcgdpu   = GDPu./Nu*Nu(1)/GDPu(1)*100;
pcgdpr   = GDPr./Nr*Nr(1)/GDPr(1)*100;
labprdu  = prdu/prdu(1)*100;
labprdr  = prdr/prdr(1)*100;
cshru    = Cu./GDPu*100;
cshrr    = Cr./GDPr*100;
xshru    = Xu./GDPu*100;
xshrr    = Xr./GDPr*100;
xtcapu   = Xd./GDPu*100;

clc
disp('Next: choose case=4 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_std
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

figure(43)
plot(data(:,1),data(:,2),'Color','k','Marker','o')
line(t,NXu./GDPu*100,'Linewidth',2,'Color','r')
line(t,nxdivgdp,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1997,-5.5,'U.S. data','Fontsize',14,'Fontname','Times')
text(1961,-1,'Model without', ...
     'Fontsize',14,'Fontname','Times')
text(1961,-1.5,'technology capital', ...
     'Fontsize',14,'Fontname','Times')
text(1961,1.8,'Model with technology capital', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,-8,4])

figure(44)
plot(t(1:5:T),pcgdpu(1:5:T),'bo', ...
     t(1:5:T),pcgdpr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Nu(1:5:T)*Nu(1)/GDPu(1)*100,'ro', ...
     t(1:5:T),GDPr(1:5:T)./Nr(1:5:T)*Nr(1)/GDPr(1)*100,'r^')
line(t,GDPu./Nu*Nu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Nr*Nr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,pcgdpu,'Linewidth',2,'Color','b')
line(t,pcgdpr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1985,104,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,101.3,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,98.5,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1985,96,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,95,105])

figure(45)
plot(t(1:5:T),labprdu(1:5:T),'bo', ...
     t(1:5:T),labprdr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Hu(1:5:T)*Hu(1)/GDPu(1)*100,'ro', ...
     t(1:5:T),GDPr(1:5:T)./Hr(1:5:T)*Hr(1)/GDPr(1)*100,'r^')
line(t,GDPu./Hu*Hu(1)/GDPu(1)*100,'Linewidth',2,'Color','r')
line(t,GDPr./Hr*Hr(1)/GDPr(1)*100,'Linewidth',2,'Color','r')
line(t,labprdu,'Linewidth',2,'Color','b')
line(t,labprdr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
set(gca,'YTick',99:103)
axis([1960,2010,99,103])
text(1980,102.3,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1973,102,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1973,100.,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1973,99.55,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')

figure(46)
plot(t(1:5:T),cshru(1:5:T),'bo', ...
     t(1:5:T),cshrr(1:5:T),'b^', ...
     t(1:5:T),Cu(1:5:T)./GDPu(1:5:T)*100,'ro', ...
     t(1:5:T),Cr(1:5:T)./GDPr(1:5:T)*100,'r^')
line(t,Cu./GDPu*100,'Linewidth',2,'Color','r')
line(t,Cr./GDPr*100,'Linewidth',2,'Color','r')
line(t,cshru,'Linewidth',2,'Color','b')
line(t,cshrr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1983,88.3,'Model with technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1984,85.4,'Model without technology capital, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1984.6,83.5,'Model with technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983.7,81.5,'Model without technology capital, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,80,90])

figure(47)
plot(t(1:5:T),xshru(1:5:T),'bo', ...
     t(1:5:T),xtcapu(1:5:T),'bs')
line(t,Xu./GDPu*100,'Linewidth',2,'Color','r')
line(t,xshru,'Linewidth',2,'Color','b')
line(t,xtcapu,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1966,17,'Model without technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,14.5,'Model with technology capital, Tangible share', ...
     'Fontsize',14,'Fontname','Times')
text(1966,4.5,'Model with technology capital, Technology share', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,2,20])

%
% Plot results for temporary change in ROW population
% for 2 different openness paths
%

clc
disp('Next: choose case=1 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap 
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

nxdivgdp = NXu./GDPu*100;
pcgdpu   = GDPu./Nu*Nu(1)/GDPu(1)*100;
pcgdpr   = GDPr./Nr*Nr(1)/GDPr(1)*100;
labprdu  = prdu/prdu(1)*100;
labprdr  = prdr/prdr(1)*100;
cshru    = Cu./GDPu*100;
cshrr    = Cr./GDPr*100;
xshru    = Xu./GDPu*100;
xshrr    = Xr./GDPr*100;
xtcapu   = Xd./GDPu*100;

clc
disp('Next: choose case=1 and yes to adjusting')
disp('Hit return to continue ')
pause

nx_tcap3
for i=1:6;
  eval(['figure(',int2str(i),'),close'])
end;

figure(53)
plot(data(:,1),data(:,2),'Color','k','Marker','o')
line(t,NXu./GDPu*100,'Linewidth',2,'Color','m')
line(t,nxdivgdp,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1988,-3,'U.S. data','Fontsize',14,'Fontname','Times')
text(1961,3.1,'Openness', ...
     'Fontsize',14,'Fontname','Times')
text(1961,2.6,'parameters', ...
     'Fontsize',14,'Fontname','Times')
text(1961,2.1,'fixed', ...
     'Fontsize',14,'Fontname','Times')
text(1961,-.5,'Openness', ...
     'Fontsize',14,'Fontname','Times')
text(1961,-1,'parameters', ...
     'Fontsize',14,'Fontname','Times')
text(1961,-1.5,'rising', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,-8,4])

figure(54)
plot(t(1:5:T),pcgdpu(1:5:T),'bo', ...
     t(1:5:T),pcgdpr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Nu(1:5:T)*Nu(1)/GDPu(1)*100,'mo', ...
     t(1:5:T),GDPr(1:5:T)./Nr(1:5:T)*Nr(1)/GDPr(1)*100,'m^')
line(t,GDPu./Nu*Nu(1)/GDPu(1)*100,'Linewidth',2,'Color','m')
line(t,GDPr./Nr*Nr(1)/GDPr(1)*100,'Linewidth',2,'Color','m')
line(t,pcgdpu,'Linewidth',2,'Color','b')
line(t,pcgdpr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1983,99.2,'Openness parameters rising, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1978,95.2,'Openness parameters fixed, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1978,102.9,'Openness parameters fixed, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1983,101,'Openness parameters rising, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,94,104])

figure(55)
plot(t(1:5:T),labprdu(1:5:T),'bo', ...
     t(1:5:T),labprdr(1:5:T),'b^', ...
     t(1:5:T),GDPu(1:5:T)./Hu(1:5:T)*Hu(1)/GDPu(1)*100,'mo', ...
     t(1:5:T),GDPr(1:5:T)./Hr(1:5:T)*Hr(1)/GDPr(1)*100,'m^')
line(t,GDPu./Hu*Hu(1)/GDPu(1)*100,'Linewidth',2,'Color','m')
line(t,GDPr./Hr*Hr(1)/GDPr(1)*100,'Linewidth',2,'Color','m')
line(t,labprdu,'Linewidth',2,'Color','b')
line(t,labprdr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
set(gca,'YTick',99:104)
axis([1960,2010,99,104])
text(1985,103,'Openness parameters fixed, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(2001,102.1,'Openness', ...
     'Fontsize',14,'Fontname','Times')
text(2001,101.9,'parameters', ...
     'Fontsize',14,'Fontname','Times')
text(2001,101.7,'rising, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1968,96.8,'Openness parameters rising, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1995.5,100.8,'Openness parameters', ...
     'Fontsize',14,'Fontname','Times')
text(1995.5,100.6,'rising, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1985,99.7,'Openness parameters fixed, U.S.', ...
     'Fontsize',14,'Fontname','Times')


figure(56)
plot(t(1:5:T),cshru(1:5:T),'bo', ...
     t(1:5:T),cshrr(1:5:T),'b^', ...
     t(1:5:T),Cu(1:5:T)./GDPu(1:5:T)*100,'mo', ...
     t(1:5:T),Cr(1:5:T)./GDPr(1:5:T)*100,'m^')
line(t,Cu./GDPu*100,'Linewidth',2,'Color','m')
line(t,Cr./GDPr*100,'Linewidth',2,'Color','m')
line(t,cshru,'Linewidth',2,'Color','b')
line(t,cshrr,'Linewidth',2,'Color','b')
set(gca,'Fontsize',14,'Fontname','Times')
text(1981,89,'Openness parameters fixed, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(2001,88.1,'Openness', ...
     'Fontsize',14,'Fontname','Times')
text(2001,87.7,'parameters', ...
     'Fontsize',14,'Fontname','Times')
text(2001,87.3,'rising, U.S.', ...
     'Fontsize',14,'Fontname','Times')
text(1975,83.2,'Openness parameters fixed, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(1965,81.6,'Openness parameters rising, ROW', ...
     'Fontsize',14,'Fontname','Times')
axis([1960,2010,80,90])

figure(57)
plot(t,sigr,'Linewidth',2,'Color','k')
line(t,sigu,'Linewidth',2,'Color','k','Linestyle','--')
set(gca,'Fontsize',14,'Fontname','Times')
text(1980,0.9,'Degree of openness, ROW', ...
     'Fontsize',14,'Fontname','Times')
text(2003,0.78,'Degree of openness, U.S.', ...
     'Fontsize',14,'Fontname','Times')

disp('ADD ARROWS TO SOME OF THE FIGURES BEFORE PRINTING')

%return
% Use the following code to print final results
%
  figure(11)
  print -depsc Figure1
  figure(12)
  print -depsc Figure2
  figure(57)
  print -depsc Figure14
  figure(21)
  print -depsc FigureA1
  figure(22)
  print -depsc FigureA2
  str1 = int2str(1);
  str2 = int2str(2);
  k    = 2;
  for j=3:7;
    k    = k+1;
    jstr = int2str(j);
    kstr = int2str(k);
    eval(['figure(',str1,jstr,')'])
    eval(['print -depsc Figure',kstr])
    eval(['figure(',str2,jstr,')'])
    eval(['print -depsc FigureA',kstr])
  end;
  str3 = int2str(3);
  str4 = int2str(4);
  for j=3:7;
    k    = k+1;
    jstr = int2str(j);
    kstr = int2str(k);
    eval(['figure(',str3,jstr,')'])
    eval(['print -depsc Figure',kstr])
    eval(['figure(',str4,jstr,')'])
    eval(['print -depsc FigureA',kstr])
  end;
  str5 = int2str(5);
  for j=3;
    k    = k+1;
    jstr = int2str(j);
    kstr = int2str(k);
    eval(['figure(',str5,jstr,')'])
    eval(['print -depsc Figure',kstr])
  end;
