/* ragwortD.sas */ option ls=72 ps=60; data ragwort1; input load mass; loadsq = load*load; logmass = log(mass); logload = log(load); logldsq = logload*logload; cards; 12.2 18.200 14.6 17.500 15.8 7.220 25.3 30.600 38.6 6.660 76.4 6.140 163 5.210 182 .502 377 .011 415 .611 446 .630 628 .427 770 .012 1012 .002 1446 .006 ; proc print data=ragwort1; title 'ragwort data'; proc plot data=ragwort1; plot mass*load; title 'plot of mass versus load'; proc plot data=ragwort1; plot logmass*load; title 'plot of log(mass) versus load'; proc plot data=ragwort1; plot logmass*logload; title 'plot of log(mass) versus log(load)'; /* add points for plotting fitted curves */ data addon1; input load mass; loadsq = load*load; logmass = log(mass); logload = log(load); logldsq = logload*logload; cards; 13 . 15 . 20 . 30 . 50 . 60 . 80 . 100 . 150 . 200 . 350 . 420 . 500 . 550 . 670 . 720 . 800 . 900 . 950 . 1050 . 1250 . 1350 . 1390 . ; proc print data=addon1; var load logload; title 'additional values for plotting fitted curves'; data ragwort; set ragwort1 addon1; /* quadratic regression of mass on load */ proc glm data=ragwort; model mass = load loadsq /ss1 ss2; output out=new1 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'quadratic regression of mass on load'; proc print data=new1; var load mass clml clmu clpl clpu yhat resid; data new1b; set new1; code = '*'; if mass = . then code = '+'; newy = mass; if mass = . then newy = yhat; proc plot data=new1b; plot newy*load = code; proc plot data=new1; plot resid*load / vref=0; proc rank data=new1 normal=blom out=new1a; var resid; ranks nscore; proc plot data=new1a; plot nscore*resid; proc univariate data=new1 plot normal; var resid; /* quadratic regression of log(mass) on load */ proc glm data=ragwort; model logmass = load loadsq / ss1 ss2; output out=new2 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'quadratic regression of log(mass) on load'; proc print data=new2; var load mass clml clmu clpl clpu yhat resid; data new2b; set new2; code = '*'; if logmass = . then code = '+'; newy = logmass; if logmass = . then newy = yhat; proc plot data=new2b; plot newy*load = code; proc plot data=new2; plot resid*load / vref=0; proc rank data=new2 normal=blom out=new2a; var resid; ranks nscore; proc plot data=new2a; plot nscore*resid; proc univariate data=new2 plot normal; var resid; /* quadratic regression of log(mass) on log(load) */ proc glm data=ragwort; model logmass = logload logldsq / ss1 ss2; output out=new3 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'quadratic regression of log(mass) on log(load)'; proc print data=new3; var load mass clml clmu clpl clpu yhat resid; data new3b; set new3; code = '*'; if logmass = . then code = '+'; newy = logmass; if logmass = . then newy = yhat; proc plot data=new3b; plot newy*logload = code; proc plot data=new3; plot resid*logload / vref=0; proc rank data=new3 normal=blom out=new3a; var resid; ranks nscore; proc plot data=new3a; plot nscore*resid; proc univariate data=new3 plot normal; var resid; run;