%TABLE4a  This program generates estimates for the UK in the 1960s
%         displayed in Tables 4 and 5 of
%
%           Taxes, Regulations, and the Value of US and UK Corporations,
%           by Ellen McGrattan and Ed Prescott
%

%         Ellen McGrattan 9-2-03


%
% Data to load:
%
%     BLUE BOOK 1971, Table 27,              annually 1960-1970
%     BLUE BOOK 1971, Table 29,              annually 1960-1970
%     BLUE BOOK 1971, Table 30,              annually 1960-1970
%     BLUE BOOK 1971, Table 52,              annually 1960-1970
%     BLUE BOOK 1971, Table 58,              annually 1960-1970
%     BLUE BOOK 1971, Table 78,              annually 1960-1970
%     Poterba and Summers (1984), Table 1,   annually 1955-1981 
%     King and Fullerton (1984), Table 3.4,  annually 1947-1980
%     Roe (1971), Tables 7-26,               annually 1957-1966
%     Equity value,                          annually 1957-2002 
%

load uk/raw/gdp.dat;
load uk/raw/bb71_tab27.dat; 
load uk/raw/bb71_tab29.dat; 
load uk/raw/bb71_tab30.dat; 
load uk/raw/bb71_tab52.dat; 
load uk/raw/bb71_tab58.dat; 
load uk/raw/bb71_tab78.dat; 
load uk/raw/poterba.dat;
load uk/raw/kingfull.dat;
i = [1:6,9,12,15,18];
load uk/raw/roe7.dat;  roe7  = [roe7(:,i),NaN*ones(66,4)];
load uk/raw/roe8.dat;  roe8  = [roe8(:,i),NaN*ones(26,4)];
load uk/raw/roe9.dat;  roe9  = [roe9(:,i),NaN*ones(19,4)];
load uk/raw/roe10.dat; roe10 = [roe10(:,i),NaN*ones(21,4)];
load uk/raw/roe11.dat; roe11 = [roe11(:,i),NaN*ones(22,4)];
load uk/raw/roe12.dat; roe12 = [roe12(:,i),NaN*ones(16,4)];
load uk/raw/roe13.dat; roe13 = [roe13(:,i),NaN*ones(15,4)];
load uk/raw/roe14.dat; roe14 = [roe14(:,i),NaN*ones(23,4)];
load uk/raw/roe15.dat; roe15 = [roe15(:,i),NaN*ones(34,4)];
load uk/raw/roe16.dat; roe16 = [roe16(:,i),NaN*ones(19,4)];
load uk/raw/roe17.dat; roe17 = [roe17(:,i),NaN*ones(27,4)];
load uk/raw/roe18.dat; roe18 = [roe18(:,i),NaN*ones(24,4)];
load uk/raw/roe19.dat; roe19 = [roe19(:,i),NaN*ones(21,4)];
load uk/raw/roe20.dat; roe20 = [roe20(:,i),NaN*ones(33,4)];
load uk/raw/roe21.dat; roe21 = [roe21(:,i),NaN*ones(17,4)];
load uk/raw/roe22.dat; roe22 = [roe22(:,i),NaN*ones(13,4)];
load uk/raw/roe23.dat; roe23 = [roe23(:,i),NaN*ones(26,4)];
load uk/raw/roe24.dat; roe24 = [roe24(:,i),NaN*ones(28,4)];
load uk/raw/roe25.dat; roe25 = [roe25(:,i),NaN*ones(21,4)];
load uk/raw/roe26.dat; roe26 = [roe26(:,i),NaN*ones(51,4)];
load uk/value/equity.dat


%
% Years to load: Y0 through Y1
%

Y0  = 1960;
Y1  = 1969;


%
% Extract data:
%

gdp            = gdp(Y0-1947:Y1-1947,2);
bb71tab27      = bb71_tab27(2:25,Y0-1959:Y1-1959);
bb71tab29      = bb71_tab29(2:21,Y0-1959:Y1-1959);
bb71tab30      = bb71_tab30(2:18,Y0-1959:Y1-1959);
bb71tab52      = bb71_tab52(2:9, Y0-1959:Y1-1959);
bb71tab58      = bb71_tab58(2:21,Y0-1959:Y1-1959);
bb71tab78      = bb71_tab78(2:27,Y0-1959:Y1-1959);
poterba        = poterba(Y0-1954:Y1-1954,2:3);
tau1           = kingfull(Y0-1946:Y1-1946,2);
equity         = equity(Y0-1956:Y1-1956,2);
roe7           = roe7(:,Y0-1956:Y1-1956);
roe8           = roe8(:,Y0-1956:Y1-1956);
roe9           = roe9(:,Y0-1956:Y1-1956);
roe10          = roe10(:,Y0-1956:Y1-1956);
roe11          = roe11(:,Y0-1956:Y1-1956);
roe12          = roe12(:,Y0-1956:Y1-1956);
roe13          = roe13(:,Y0-1956:Y1-1956);
roe14          = roe14(:,Y0-1956:Y1-1956);
roe15          = roe15(:,Y0-1956:Y1-1956);
roe16          = roe16(:,Y0-1956:Y1-1956);
roe17          = roe17(:,Y0-1956:Y1-1956);
roe18          = roe18(:,Y0-1956:Y1-1956);
roe19          = roe19(:,Y0-1956:Y1-1956);
roe20          = roe20(:,Y0-1956:Y1-1956);
roe21          = roe21(:,Y0-1956:Y1-1956);
roe22          = roe22(:,Y0-1956:Y1-1956);
roe23          = roe23(:,Y0-1956:Y1-1956);
roe24          = roe24(:,Y0-1956:Y1-1956);
roe25          = roe25(:,Y0-1956:Y1-1956);
roe26          = roe26(:,Y0-1956:Y1-1956);

%
% Intermediate variables
%

xic            = sum(bb71tab29(16:17,:))';
xfc            = bb71tab30(15,:)'; 
x1m            = bb71tab52(2,:)';
itcic          = bb71tab29(13,:)';
itcfc          = bb71tab30(12,:)';
tauxic         = itcic./xic;
tauxfc         = itcfc./xfc;
taux           = (itcic+itcfc)./(xic+xfc);
taud           = poterba(:,1);
gprf           = bb71tab27(1,:)';
taxprf         = bb71tab27(17,:)';
del1m          = bb71tab58(16,:)';
rowprf         = -sum(bb71tab78(21:22,:))';
fdrat          = rowprf./(gprf-del1m-taxprf);
k1m            = (sum(roe26([2:5],:))+roe8(2,:)+roe9(2,:)+roe10(2,:)+ ...
                  roe11(2,:)+roe15(2,:)+roe20(2,:)+sum(roe23(2:4,:))+ ...
                  roe24(2,:)+roe25(2,:))'./gdp;
                 % includes Roe's sectors 2.1.1-4,2.4.1,2.6.1,2.7.1-3,3.0.0
k1u            = 1.5/1.62*.714;  
                 % = UK/US nondefense R&D in 1972 as % of GDP *k_{1u,US}
nfdebtl        = sum(roe26([33:38,42:48],:)); 
nfdfil         = roe26(41,:);
nfdebta        = sum(roe26([7:20,24:31],:));
nfdfia         = roe26(23,:);
fcdebtl        = roe8(21,:)+sum(roe9(12:14,:))+sum(roe10(15:16,:))+ ...
                 sum(roe11([14:16,19],:))+sum(roe20([22:24,27:30],:))+ ...
                 sum(roe23([15:18,21:23],:))+sum(roe24([19:21,23:25],:))+ ...
                 sum(roe25([11:14,16:18],:));
fcdebta        = sum(roe8([3:11,14:15,17:19],:))+ ...
                 sum(roe9([3:8,10],:))+sum(roe10([3:11,13],:))+ ...
                 sum(roe11([3:8,10:12],:))+sum(roe20([4:14,17:20],:))+ ...
                 sum(roe23([5:6,10:13],:))+sum(roe24([4:11,14:17],:))+ ....
                 sum(roe25([3:5,7:9],:))- ...
                 .5*(roe8(15,:)+roe10(11,:)+roe20(18,:)+roe24(14,:)+roe25(7,:));
fcdfia         = roe8(16,:)+roe9(9,:)+roe10(12,:)+roe11(9,:)+roe23(9,:);
                 % NOTES:
                 % (1) includes Roe's Sectors 2.1.1-4,2.4.1,2.6.1,2.7.1-3,3.0.0
                 % (2) 1/2 of overseas company securities assumed to be debt 
lidebtl        = sum(roe15([25,26,29,31],:));
lidebta        = sum(roe15([3:15,19,21:23],:))-.5*roe15(19,:);
lidfia         = roe15(20,:);
liassets       = roe15(24,:)-roe15(2,:);
reserves       = roe15(30,:);
lidebta        = lidebta-(lidebta./liassets).*reserves;
lidfia         = lidfia-(lidfia./liassets).*reserves;
wgtl           = 1/4;
wgta           = 1/20; 
debtl          = nfdebtl+fcdebtl+lidebtl+wgtl*nfdfil;
debta          = nfdebta+fcdebta+lidebta+wgta*(nfdfia+fcdfia+lidfia);
netdebt        = (debtl-debta)'./gdp;
t69            = find([Y0:Y1]==1969);
vf1            = (1-taud(t69))*(1-taux(t69))*avgnan(k1m);
vf2            = (1-taud(t69))*(1-tau1(t69))*k1u;
vf3            = (vf1+vf2)*mean(fdrat);

%
% Generate Table:
%

clc
disp('TABLE 4. A Comparison of Capital Stocks and Tax Rates for the US and UK')
disp('=====================================================================')
disp('                            United States          United Kingdom    ')
disp('                         ---------------------  ---------------------')
disp('                         1960-1969   1990-2001  1960-1969   1990-2001')
disp('---------------------------------------------------------------------')
disp('                                                                     ')
disp(sprintf( ....
     'Domestic tangible/GDP       0.99        1.03      %5.2f',avgnan(k1m)))
disp(' ')
disp(sprintf( ....
     'Estimate of intangible/GDP  0.71        0.65      %5.2f',k1u))
disp(' ')
disp(sprintf( ....
     'Foreign/Domestic Profits    0.11        0.29      %5.2f',mean(fdrat)))
disp(' ')
disp('Tax Rates:')
disp('    Corporate Profits')
disp(sprintf( ....
     '       End of period        45.0        34.9      %5.1f', ...
             tau1(t69)*100))
disp(sprintf( ....
     '       Average              43.2        35.3      %5.1f', ...
             mean(tau1)*100))
disp('    Corporate Dividends')
disp(sprintf( ....
     '       End of period        41.8        17.3      %5.1f', ...
             taud(t69)*100))
disp(sprintf( ....
     '       Average              41.1        17.4      %5.1f', ...
             mean(taud)*100))
disp('    Investment subsidy')
disp(sprintf( ....
     '       End of period         2.2         0.0      %5.1f', ...
             taux(t69)*100))
disp(sprintf( ....
     '       Average               2.0         0.0      %5.1f', ...
             mean(taux)*100))
disp('=====================================================================')
disp(' ')
disp(' ')

disp('TABLE 5. Predicted and Actual Corporate Values for the US and UK     ')
disp('=====================================================================')
disp('                            United States          United Kingdom    ')
disp('                         ---------------------  ---------------------')
disp('                         1960-1969   1990-2001  1960-1969   1990-2001')
disp('---------------------------------------------------------------------')
disp(' Predicted Fundamental Values: ')
disp(' ')
disp(sprintf( ...
     '   Domestic tangible       0.563       0.838       %5.3f',vf1))
disp(sprintf( ...
     '   Domestic intangible     0.229       0.350       %5.3f',vf2))
disp(sprintf( ...
     '   Foreign capital         0.086       0.379       %5.3f',vf3))
disp('                           -----       -----       -----     ')
disp(sprintf( ...
     '   TOTAL                   0.877       1.567       %5.3f',vf1+vf2+vf3))
disp(' ')
disp(' ')
disp(' Actual Market Values: ')
disp(' ')
disp(sprintf( ...
     '   Corporate equity        0.898       1.576       %5.3f', ...
         mean(equity)))
disp(sprintf( ...
     '   Net Debt                0.041       0.028      %6.3f', ...
         avgnan(netdebt)*(1-taud(t69)) ))
disp('                           -----       -----       -----     ')
disp(sprintf( ...
     '   TOTAL                   0.940       1.604       %5.3f', ...
         mean(equity)+avgnan(netdebt)*(1-taud(t69)) ))
disp('======================================================================')
disp('NOTE: run table4b.m for last column of Table 4 and Table 5')
