ods html;

ods graphics on;

/*White's Approximate Estimator for the Variance of the Least Square Estimator*/

 

/*Method 1 in proc reg*/

proc reg data=expeninc;

model y=x/acov;

run;

 

/*Method 2 in proc model*/

proc model data=expeninc;

parms b0 b1 ;

y=b0+b1*x;

fit y/white HCCME=0;

run;

 

/*Weighted Least Square by Transformed Model*/

data new;

set expeninc;

ystar=y/sqrt(x);

x1star=x/sqrt(x);

x0star=1/sqrt(x);

run;

proc reg data=new;

model ystar=x1star x0star/noint;

run;

 

/*Weighted Least Square */

data expengls;

set expeninc;

w=1/x;

run;

 

 

proc reg data=expengls;                          * estimate regression;

expengls:model y=x;                              * use original data;

weight w;                                       * specify weight for weighted LS = GLS;

run;

ods graphics off;

ods html close;