/***************************************************************************/ /* */ /* Title: GRAPHMSD.GPG */ /* */ /* Written: John H. Cochrane */ /* by: University of Chicago Graduate School of Business */ /* 1101 E. 58th Street, Rosenwald 2xx */ /* Chicago, Ill 60637 */ /* ph#: (312) 702-3059 */ /* e-mail: fac_jhc@gsbacd.uchicago.edu */ /* */ /*Modified: Caleb C. Wong */ /* by: University of Chicago Department of Economics */ /* 1126 East 59th St. */ /* Chicago, Ill 60637 */ /* ph#: (312) 702-8254 */ /* e-mail: wongcc@sam.spc.uchicago.edu */ /* */ /* Purpose: graphs mean vs. standard deviation: */ /* (1) individual stock returns */ /* (2) vw, ex, and 10 decile portfolios */ /* */ /* Data: Quarterly averaged returns created by redodat.gpg and GAUSS */ /* formatted (indicated by .fmt extension) */ /* */ /* */ /* */ /***************************************************************************/ /*----------------------------------*/ /* Part I. (1) GAUSS library calls */ /* (2) reset globals */ /* (3) identify datapaths */ /* (4) load data */ /*----------------------------------*/ library pgraph,gmm; dpath(1); /* 0: John's datapath */ /* 1: Caleb's datapath */ load avdecret,avvwret,avewret,avustret,aindstrt,avdecret; load avew10,avew20,avvw10y,avvw20y,avvw10m,avvw20m; /* graphset; /*-----------------------------------------*/ /* Part II. Setting common graph settings */ /*-----------------------------------------*/ xlabel("Std. Dev. excess return (% per qtr.)") ylabel("Mean excess return (% per qtr.)"); _Plctrl = -1; _pstype = 9|3|2|13; _Psymsiz = 4; _protate = 1; _plegstr = "CRSP-Deciles\000VW, EW\000Individ\000Vintiles"; _plegctl = { 2 4 4.75 3.5 }; margin(0,0,0,2); /*-------------------------------------------------------*/ /* Part III. Compute excess returns and std. deviations */ /*-------------------------------------------------------*/ r = (avdecret~avvwret~avewret~aindstrt~avvw20y)-avustret; py = 100*meanc(r); px = 100*stdc(r); /*xtics(0,18,1,0); ytics(0,4.5,.5,1);*/ /*-------------------------------------------------------*/ /* Part IV. Match decile data w/ individual data */ /* NOTE: THERE'S MORE INDIVIDUAL STOCK DATA */ /* THAN DECILE DATA */ /*-------------------------------------------------------*/ title("All Returns\L Portfolios + Individual Returns"); pxx = px[1:10]|zeros(44,1); pyy = py[1:10]|zeros(44,1); pxxx = zeros(10,1)|px[11:12]|zeros(42,1); pyyy = zeros(10,1)|py[11:12]|zeros(42,1); pxxxx = zeros(12,1)|px[13:34]|zeros(20,1); pyyyy = zeros(12,1)|py[13:34]|zeros(20,1); pxxxxx = zeros(34,1)|px[35:54]; pyyyyy = zeros(34,1)|py[35:54]; xy(pxx~pxxx~pxxxx~pxxxxx,pyy~pyyy~pyyyy~pyyyyy); dos copy graphic.tkf graphmsd.tkf; /* ----------------------------------------------------- */ /* Part V. Compare among K.French made decile portfolios */ /* ----------------------------------------------------- */ /* Comparing the decile portfolios */ r = (avdecret~avew10~avvw10y~avvw10m)-avustret; py = 100*meanc(r); px = 100*stdc(r); pyy = py[1:10]|zeros(30,1); pxx = px[1:10]|zeros(30,1); pyyy = zeros(10,1)|py[11:20]|zeros(20,1); pxxx = zeros(10,1)|px[11:20]|zeros(20,1); pyyyy = zeros(20,1)|py[21:30]|zeros(10,1); pxxxx = zeros(20,1)|px[21:30]|zeros(10,1); pyyyyy = zeros(30,1)|py[31:40]; pxxxxx = zeros(30,1)|px[31:40]; _plegstr = "Deciles-CRSP\000EW-DEC\000VW-BRkPT\000VW-MRET"; _pstype = 2|9|4|12; /*xtics(0,12,1,0); ytics(0,4.5,.5,1);*/ xy(pxx~pxxx~pxxxx~pxxxxx,pyy~pyyy~pyyyy~pyyyyy); output file = graph.out reset; " CRSPmeans EWmeans VW-10ymeans VW-10mmeans"; py[1:10]~py[11:20]~py[21:30]~py[31:40]; " CRSPstddv EWstddv VW-10ystddv VW-10mstddv"; px[1:10]~px[11:20]~px[21:30]~px[31:40]; /* Compare Vintiles */ r = (avdecret~avew20~avvw20y~avvw20m)-avustret; py = 100*meanc(r); px = 100*stdc(r); pyy = py[1:10]|zeros(60,1); pxx = px[1:10]|zeros(60,1); pyyy = zeros(10,1)|py[11:30]|zeros(40,1); pxxx = zeros(10,1)|px[11:30]|zeros(40,1); pyyyy = zeros(30,1)|py[31:50]|zeros(20,1); pxxxx = zeros(30,1)|px[31:50]|zeros(20,1); pyyyyy = zeros(50,1)|py[51:70]; pxxxxx = zeros(50,1)|px[51:70]; _plegstr = "Deciles-CRSP\000EW-DEC\000VW-BRkPT\000VW-MRET"; _pstype = 2|9|4|12; /*xtics(0,12,1,0); ytics(0,4.5,.5,1);*/ xy(pxx~pxxx~pxxxx~pxxxxx,pyy~pyyy~pyyyy~pyyyyy); " CRSPmeans EWmeans VW-10ymeans VW-10mmeans"; (py[1:10]|zeros(10,1))~py[11:30]~py[31:50]~py[51:70]; " CRSPstddv EWstddv VW-10ystddv VW-10mstddv"; (px[1:10]|zeros(10,1))~px[11:30]~px[31:50]~px[51:70]; output off; */ /* compare returns */ /* select returns to evaluate */ graphset; title("Compare Avg. Rets. Among Size Ports."); xlabel("Period"); ylabel("Return"); _pltype = 6|6; _pcolor = 1|4; col = 1; row = 50; do while col<10; xy(seqa(1,1,rows(row)),avdecret[1:row,col]~avvw10y[1:row,col]); col = col + 1; endo;