Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Re: WLS - Residuals not equal zero with intercept

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-29-2018 06:19 AM
(1852 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;
```

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you so much Rick! I was indeed missing the point that the mean has to be weighted too.

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.