/* firefly2.sas */ options ls=72 ps=60; data firefly; infile 'firefly.dat'; input date condition $ time temp light; if condition = 'overcast' then delete; proc plot data=firefly; plot time*light; plot time*temp; plot time*date; plot temp*date; plot light*date; plot light*temp; title 'firefly example plots'; /* adjust time for date */ proc glm data=firefly; model time = date; output out=newtime r=adjtime; title 'regression of time on date for adjustment of time'; proc plot data=newtime; plot adjtime*temp; plot adjtime*light; proc print data=newtime; var time temp light date adjtime; /* fit models */ /* regression of time on date temp and light (full model) */ proc glm data=firefly; model time = date temp light / ss1 ss2 clparm; output out=new1 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'regression of time on date temp and light (full model)'; proc print data=new1; var time temp light clml clmu clpl clpu yhat resid; proc plot data=new1; plot resid*yhat / vref=0; plot resid*date / vref=0; plot resid*temp / vref=0; plot resid*light / vref=0; title 'residual plots: full model'; /* regression of time on date and temp (reduced model) */ proc glm data=firefly; model time = date temp / ss1 ss2 clparm; output out=new2 predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'regression of time on date and temp (reduced model)'; proc print data=new2; var time temp light clml clmu clpl clpu yhat resid; proc plot data=new2; plot resid*yhat / vref=0; plot resid*date / vref=0; plot resid*temp / vref=0; title 'residual plots: reduced model'; /* use proc reg to get sequential regression coefficients */ proc reg data=firefly; model time = date temp light / seqb ss1 ss2; title 'regressions with sequential coefficients'; run;