%PLOTGAINS
%
disp(' Which model economy? ')
disp('   Benchmark in steps:')
disp('     1: FICA taxes and transfers phased out')
disp('     2: Additionally, suspend deductibility of benefits')
disp('     3: Additionally, lower marginal tax rates on workers')
disp('     4: Same as 3, with lower marginal rates permanent')
disp('     5: Same as 4, but also phase out capital taxes')
disp('     6: Same as 4, but increase NIPA transfers to lower incomes')
disp('   Sensitivity (with #4 as baseline):')
disp('     7: Only Social Security phased out')
disp('     8: Debt to GNP equal to 1')
disp('     9: Larger government consumption')
disp('    10: Smaller government consumption')
disp('    11: Life expectancy rises with productivity')
disp('    12: No annuity markets')
disp('    13: No annuity markets and intergenerational transfers')
disp('    14: Lower labor elasticity')
disp('    15: Age-dependent productivities')
disp('    16: Same as 4, with smoother net tax schedule')
disp('    17: Same as 5, with smoother net tax schedule')
disp('    18: 1-sector, 1-capital model (with smoother net tax schedule)')
disp('    19: Same as 18, but also phase out capital taxes')
disp('    20: More productivity levels')
disp('    21: FICA taxes and transfers phased out at same rate')
icase = input('? ');

!rm -f trantf.dat
if (icase==1);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/nofica.dat
  newpolt = nofica;
end;
if (icase==2);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/nofringe.dat
  newpolt = nofringe;
end;
if (icase==3);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/reverse.dat
  newpolt = reverse;
end;
if (icase==4);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/nomedss.dat
  newpolt = nomedss;
end;
if (icase==5);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/nocaptax.dat
  newpolt = nocaptax;
end;
if (icase==6);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/eqgain.dat
  newpolt = eqgain;
end;


if (icase==7);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/ssonly/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==8);
  !cp ../sensitivity/bigdebt/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/bigdebt/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==9);
  !cp ../sensitivity/biggovt/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/biggovt/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==10);
  !cp ../sensitivity/smallgovt/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/smallgovt/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==11);
  !cp ../sensitivity/lifeexp/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/lifeexp/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==12);
  !cp ../sensitivity/noannuity/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/noannuity/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==13);
  !cp ../sensitivity/bequests/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/bequests/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==14);
  !cp ../sensitivity/elasticity/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/elasticity/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==15);
  !cp ../sensitivity/epsrising/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/epsrising/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==16);
  !cp ../sensitivity/moretau/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/moretau/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==17);
  !cp ../sensitivity/moretau/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/moretau/nocaptax.dat 
  newpolt = nocaptax;
end;
if (icase==18);
  !cp ../sensitivity/onesector/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/onesector/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==19);
  !cp ../sensitivity/onesector/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/onesector/nocaptax.dat 
  newpolt = nocaptax;
end;
if (icase==20);
  !cp ../sensitivity/morebins/continue.dat trantf.dat 
  load trantf.dat
  curpolt = trantf;
  load ../sensitivity/morebins/nomedss.dat 
  newpolt = nomedss;
end;
if (icase==21);
  !cp ../benchmark/continue.dat trantf.dat
  load trantf.dat
  curpolt = trantf;
  load ../benchmark/noficas.dat
  newpolt = noficas;
end;

if (icase==14);
  WG = gains_e(curpolt,newpolt);  WG=[WG(1:215,:);ones(35,1)*WG(215,:)];
else
  WG = gains(curpolt,newpolt);    WG=[WG(1:215,:);ones(35,1)*WG(215,:)];
end;

figure,plot(WG,'LineWidth',2)
line([0,250],[0,0],'Color','Black')
xlabel('Birth-Year Cohort','Fontsize',14)
axis([0,250,-10,30])
set(gca,'XTickLabel',[100,50,0,-50,-100,-150],'Fontsize',14)
legend('Low','Medium','High','Top 1%','Location','Northwest')
if (icase==20);
  legend('Low','Low','Medium','Medium','High', ...
         'High','Top 1%','Location','Northwest')
end;
legend('boxoff')
title({'Figure 1'; ...
 '% Welfare Gain of Eliminating Old-Age Transfers'}, ...
 'Fontsize',14)

