%TABLE1   computations for Table 1.
%

%         Ellen McGrattan, 4-24-00


load /usr/people/erm/papers/qr2/khil/vwrd.dat
load sbbi2699.dat
x      = sbbi2699;
X      = [x(:,[4,2]),x(:,12)+x(:,10),x(:,[6,10,11])];
i      = 1:18;
X(i,3) = vwrd(i,2);

t0     = [1926,1926,1945,1945,1926,1976,1981,1990,1945];
t1     = [1998,1999,1998,1999,1975,1980,1999,1999,1999];
t0     = [1926,1945,1981,1991];
t1     = [1999,1999,1999,1999];
lt0    = length(t0);

disp('FINANCIAL ASSET RETURNS, 1926-1999')
disp(' ')
for i = 1:lt0;

  t     = t0(i):t1(i);
  lt    = length(t);
  n0    = 12*(t0(i)-1926)+1;
  n1    = 12*(t1(i)-1925);
  n     = length(n0:n1);

  rsm   = X(n0:n1,1);
  rsp   = X(n0:n1,2);
  rvw   = X(n0:n1,3);
  rtbo  = X(n0:n1,4);
  rtbi  = X(n0:n1,5);
  rpi   = X(n0:n1,6);
  rrsm  = rsm-rpi;
  rrsp  = rsp-rpi;
  rrvw  = rvw-rpi;
  rrtbo = rtbo-rpi;
  rrtbi = rtbi-rpi;

  z     = zeros(12,lt);
  z(:)  = rsm;
  arsm  = (prod(1+z)'-1)*100;
  z(:)  = rsp;
  arsp  = (prod(1+z)'-1)*100;
  z(:)  = rvw;
  arvw  = (prod(1+z)'-1)*100;
  z(:)  = rtbo;
  artbo = (prod(1+z)'-1)*100;
  z(:)  = rtbi;
  artbi = (prod(1+z)'-1)*100;
  z(:)  = rpi;
  arpi  = (prod(1+z)'-1)*100;
  z(:)  = rrsm;
  arrsm = (prod(1+z)'-1)*100;
  z(:)  = rrsp;
  arrsp = (prod(1+z)'-1)*100;
  z(:)  = rrvw;
  arrvw = (prod(1+z)'-1)*100;
  z(:)  = rrtbo;
  arrtbo= (prod(1+z)'-1)*100;
  z(:)  = rrtbi;
  arrtbi= (prod(1+z)'-1)*100;

  crsm  = cumprod(1+rsm);
  crsp  = cumprod(1+rsp);
  crvw  = cumprod(1+rvw);
  crtbo = cumprod(1+rtbo);
  crtbi = cumprod(1+rtbi);
  crpi  = cumprod(1+rpi);
  crrsm = cumprod(1+rrsm);
  crrsp = cumprod(1+rrsp);
  crrvw = cumprod(1+rrvw);
  crrtbo= cumprod(1+rrtbo);
  crrtbi= cumprod(1+rrtbi);

  avg(i,:)  = mean([rsm,rsp,rvw,rtbo,rtbi,rpi]*100)*12;
  var(i,:)  = std( [rsm,rsp,rvw,rtbo,rtbi,rpi]*100)*sqrt(12);
  cum(i,:)  = mean([arsm,arsp,arvw,artbo,artbi,arpi]);
  tem       = [crsm,crsp,crvw,crtbo,crtbi,crpi];
  val(i,:)  = tem(n,:);
  imp(i,:)  = (val(i,:).^(1/lt)-1)*100; 

  ravg(i,:) = mean([rrsm,rrsp,rrvw,rrtbo,rrtbi]*100)*12;
  rvar(i,:) = std( [rrsm,rrsp,rrvw,rrtbo,rrtbi]*100)*sqrt(12);
  rcum(i,:) = mean([arrsm,arrsp,arrvw,arrtbo,arrtbi]);
  tem       = [crrsm,crrsp,crrvw,crrtbo,crrtbi];
  rval(i,:) = tem(n,:);
  rimp(i,:) = (rval(i,:).^(1/lt)-1)*100; 

end;

rlab1 = [' ';' '];
rlab2  = [int2str(t0'),ones(lt0,1)*'-',int2str(t1'-1900)];
clab2 = ['3    Stocks    ';
         '2 U.S. Treasury';
         '1              '];
clab3 = ['   Small  ';
         '  S&P 500 ';
         ' Value-wgt';
         '  T-Bonds ';
         '  T-Bills ';
         ' Inflation'];

disp('NOMINAL ANNUAL RATES OF RETURN')
disp('Average Monthly returns (multiplied by 12):')
disp(mattab1(avg,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Monthly returns Cumulated to Annual Returns (and averaged):')
disp(mattab1(cum,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Standard Deviation of Monthly Return (multiplied by sqrt(12)):')
disp(mattab1(var,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('RESULT OF $1 INVESTED AT START OF PERIOD')
disp('Value at End of Period:')
disp(mattab1(val,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Implied Annual Return:')
imp = real(imp);
disp(mattab1(imp,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')

disp(' ')
disp(' ')

clab2 = ['3    Stocks    ';
         '2 U.S. Treasury'];
clab3 = ['     Small    ';
         '    S&P 500   ';
         '   Value-wgt  ';
         '    T-Bonds   ';
         '    T-Bills   '];

disp('REAL ANNUAL RATES OF RETURN')
disp('Average Monthly returns (multiplied by 12):')
disp(mattab1(ravg,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Monthly returns Cumulated to Annual Returns (and averaged):')
disp(mattab1(rcum,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Standard Deviation of Monthly Return (multiplied by sqrt(12)):')
disp(mattab1(rvar,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('REAL VALUE OF $1 INVESTED AT START OF PERIOD')
disp('Value at End of Period:')
disp(mattab1(rval,2,0,0,clab2,clab3,rlab1,rlab2,0))
disp(' ')
disp('Implied Annual Return:')
rimp = real(rimp);
disp(mattab1(rimp,2,0,0,clab2,clab3,rlab1,rlab2,0))

