/* works out numbers for constantinides - duffie example */ library pgraph; output file=constant.out reset; convt = 0; /* table of s(dc) vs risk aversion */ gam = seqa(1,1,20); rho = 0.05; Elnr = 0.09; slnr = 0.17; sdc = (1.0./(gam.*(gam+1)))^2.0.*slnr^2; sdc = sdc^0.5; "gamma, second term of sdev Dc"; gam~(100*sdc); /* cross-sectional dispersion */ gam = 1|2|5|10|25; edca = 0.01; lnrm = seqb(-0.25,0.25,0.005); y = 2./(gam.*(1+gam)).*(rho-lnrm'+gam*edca); y = y .* (y.>=0); y = y^0.5; /* make table */ format /RD 6,2; "r on rows, gam on cols, cross sec sd of dc growth" ; 0~gam'; lnrm~y'; graphjc; fonts("simplex simgrma"); _pcolor = 15; title("Cross-sectional standard deviation of consumption growth\L"$+ "in Constantinides-Duffie Model"); xlabel("Market return, %"); ylabel("Standard deviation, %"); px = (100*lnrm); py = 100*y'; _pmsgstr = "\202g\201 = 1\000\202g\201 = 2\000\202g\201 = 5"$+ "\000\202g\201 = 10\000\202g\201 = 25"; _pmsgctl = (px[1]*ones(cols(py),1))~(py[1,.]'+1)~ ( ones(cols(py),1)*(0.15~0~1~15~0) ) ; xtics(-25,25,5,0); "Cross-sectional standard deviation of consumption growth"; "in Constantinides-Duffie Model"; format /RD 10,6; "x data"; px; "y data" ; py; xy(px,py); if convt; dos pqgrun graphic.tkf -CF=dufc.pic -C=2; endif; output off; /* /*artificial dc, r data */ nI = 10; /* number of people */ nT = 10; /* number of time periods (for aggregate c) */ Dc = 1.01; gam = 2; t = 1; do while t <= nT; lnr = elnr+slnr*rndn(1,1); i = 1; do while i <= ni; y2 = 2/(gam*(gam+1))*(rho-lnr+gam*dc) */