%TABLE7      makes Table 7 (Impact of Demographic and Policy Change) 
%
%            Ellen McGrattan, 2-2-16
%            Revised, erm, 2-10-16


Tab          = zeros(8);
%
% For each case, fill in current US values
%

for icase=1:8;
  !rm -f trantf.dat
  if (icase>=1 & icase<=3)
    % 
    % Current US
    %
    GNP0     = 0.745;
    L0       = 0.294;
    W0       = 1.484;
    KTeoy0   = 4.140*GNP0;
    KIeoy0   = 1.724*GNP0;
    C0       = 0.744*GNP0;
    NWhh0    = 5.574*GNP0;
  end;
  
  if (icase==1);
    %
    % Continue US policy
    %
    !cp ../benchmark/continue.dat trantf.dat
  end;
  if (icase==2)
    % 
    % Baseline reform
    %
    !cp ../benchmark/nomedss.dat trantf.dat
  end;
  if (icase==3)
    % 
    % Only Social Security eliminated
    %
    !cp ../sensitivity/ssonly/nomedss.dat trantf.dat
  end;
  if (icase==4)
    % 
    % Debt to GNP = 1
    %
    GNP0     = 0.733;
    L0       = 0.293;
    W0       = 1.465;
    KTeoy0   = 4.178*GNP0;
    KIeoy0   = 1.750*GNP0;
    C0       = 0.749*GNP0;
    NWhh0    = 6.108*GNP0;
    !cp ../sensitivity/bigdebt/nomedss.dat trantf.dat
  end; 
  if (icase==5)
    % 
    % Life expectancies vary with productivity
    %
    GNP0     = 0.733;
    L0       = 0.288;
    W0       = 1.486;
    KTeoy0   = 4.161*GNP0;
    KIeoy0   = 1.732*GNP0;
    C0       = 0.758*GNP0;
    NWhh0    = 5.600*GNP0;
    !cp ../sensitivity/lifeexp/nomedss.dat trantf.dat
  end;
  if (icase==6)
    %
    % Age-dependent labor productivities
    %
    GNP0     = 0.791;
    L0       = 0.311;
    W0       = 1.488;
    KTeoy0   = 4.156*GNP0;
    KIeoy0   = 1.729*GNP0;
    C0       = 0.743*GNP0;
    NWhh0    = 5.593*GNP0;
    !cp ../sensitivity/profiles/nomedss.dat trantf.dat
  end;
  if (icase==7)
    %
    % No annuity markets
    %
    GNP0     = 0.681;
    L0       = 0.283;
    W0       = 1.402;
    KTeoy0   = 3.947*GNP0;
    KIeoy0   = 1.686*GNP0;
    C0       = 0.761*GNP0;
    NWhh0    = 5.364*GNP0;
    !cp ../sensitivity/noannuity/nomedss.dat trantf.dat
  end;
  if (icase==8)
    %
    % Frisch elasticity is 0.5
    %
    GNP0     = 0.736;
    L0       = 0.293;
    W0       = 1.466;
    KTeoy0   = 4.071*GNP0;
    KIeoy0   = 1.705*GNP0;
    C0       = 0.747*GNP0;
    NWhh0    = 5.693*GNP0;
    !cp ../sensitivity/extremee/nomedss.dat trantf.dat
  end;

  load trantf.dat
  if (icase==8);
    plottrantf_e
  else
    plottrantf
  end;

  Tab(:,icase)  ...
             = [irate(240)-1, ...
                (KT1eoy(240)+KT2eoy(240))/KTeoy0-1, ...
                (KI1eoy(240)+KI2eoy(240))/KIeoy0-1, ...
                (L1(240)+L2(240))/L0-1, ...
                w(240)/W0-1, ...
                C(240)/C0-1, ...
                GDP(240)/GNP0-1, ...
                NWhh(240)/NWhh0-1]*100;

end;
!rm -f trantf.dat


clc
disp('                 TABLE 7. IMPACT OF DEMOGRAPHIC AND POLICY CHANGE')
disp('---------------------------------------------------------------------------------------')
disp(' Statistic/Economy:            (1)    (2)    (3)    (4)    (5)    (6)    (7)    (8)    ')
disp('---------------------------------------------------------------------------------------')
disp(sprintf('  Interest rate, level (%%)  %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(1,:)));
disp(        '  Change rel to current US:')
disp(sprintf('    Tangible capital        %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(2,:)));
disp(sprintf('    Intangible capital      %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(3,:)));
disp(sprintf('    Labor input             %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(4,:)));
disp(sprintf('    Wage rate               %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(5,:)));
disp(sprintf('    Consumption             %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(6,:)));
disp(sprintf('    GNP                     %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(7,:)));
disp(sprintf('    Net worth               %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f',Tab(8,:)));
disp('---------------------------------------------------------------------------------------')
disp(' Notes: ')
disp('   (1) Continue US policy')
disp('   (2) Baseline reform with T(y) changed permanently')
disp('   (3) Only Social Security phased out')
disp('   (4) Debt to GNP equal to 1')
disp('   (5) Survival probabilities depend on productivity')
disp('   (6) Productivities are age-dependent')
disp('   (7) Annuity markets are shut down')
disp('   (8) Frisch elasticity is 0.5')
