BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Alain38
Quartz | Level 8

Hello,

Please excuse this basic question but the sum of the residuals with the following weighted least squares regression, which includes an intercept, does not equal zero (-0.1025)... Is it normal?

 

data Work.Sample;
      input  x y w; 
   datalines;
   0.0067   13.3832     0.3989422804
   0.0133   17.271      0.3946744272
   0.02     15.0223     0.3818928999
   0.0267   18.1516     0.3614238299
   0.0333   13.6427     0.3349933138
   0.04     16.6002     0.3033892838
   0.0467   16.7669     0.2687428615
;

proc reg data=Work.Sample outest=Work.Coeff tableout noprint;
	model y = x;
	weight w;
	output out=Work.Residuals  r=residuals;
quit;

proc means data=Work.Residuals sum;
	var residuals;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I assume you mean "is this the expected behavior." Yes. In fact, it's why weighting is useful for robust regression estimates. If an observation is an outlier, you can downweight it. Then the fit doesn't go through the middle of the data anymore.

 

However, the residuals do still have WEIGHTED means of zero:

 

proc means data=Work.Residuals sum mean;
   var residuals;
   weight w;
run;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

I assume you mean "is this the expected behavior." Yes. In fact, it's why weighting is useful for robust regression estimates. If an observation is an outlier, you can downweight it. Then the fit doesn't go through the middle of the data anymore.

 

However, the residuals do still have WEIGHTED means of zero:

 

proc means data=Work.Residuals sum mean;
   var residuals;
   weight w;
run;
Alain38
Quartz | Level 8
Thank you so much Rick! I was indeed missing the point that the mean has to be weighted too.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2000 views
  • 1 like
  • 2 in conversation