data a1; infile 'U:\.www\datasets512\Ch10ta01.dat'; input age diast; proc print data=a1; run; *Weighted regression analysis. Used to adjust for nonconstant variance. This is very obvious in the scatterplot. First fit the model as usual and save the residuals; symbol1 v=circle i=sm70; proc sort data=a1; by age; proc gplot data=a1; plot diast*age/frame; run; proc reg data=a1; model diast=age; output out=a2 r=resid; run; *Compute the absolute and squared residuals to find pattern with age; data a2; set a2; absr=abs(resid); sqrr=resid*resid; proc gplot data=a2; plot (resid absr sqrr)*age; run; *From scatterplot, model absolute residual as a linear function of age. Fit model and predict the standard deviation for each observation; proc reg data=a2; model absr=age; output out=a3 p=shat; *Compute weights; data a3; set a3; wt=1/(shat*shat); *Run wieghted analysis using weight statement; proc reg data=a3; model diast=age / clb; weight wt; run;