turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Proc nlin with weights and SSE

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2016 08:17 AM

Hi

I have a problem estimating a nlin function on weighted data which basically comes down to the problem below:

Consider the following data where clearly y =x² and z aresome weights. Bij adapting the standard proc nlin to include the weights:

```
data STARTDATA;
input x y z ;
datalines ;
1 2 0.1
2 4 0.2
3 9 0.2
4 16 0.5
;
PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted AS
SELECT T.y, T.x, T.z
FROM WORK.STARTDATA as T;
PROC NLIN DATA=WORK.SORTTempTableSorted
MAXITER=100
CONVERGE=1E-05
SINGULAR=1E-08
MAXSUBIT=30;
_WEIGHT_ = z;
MODEL y = x ** b
;
PARMS
b=0.01;
RUN;
```

The parameter b is estimated correctly as 2. However the SSE is minimized to the first weight which is 0.1 and is not further decreased to 0.

This makes the R² (here 1) wrongly estimated.

How can I correct my example such that the SSE can be smaller than the first weight?

Thanks in advance

Accepted Solutions

Solution

02-01-2016
10:45 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2016 10:43 AM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to RB_Wouter

02-01-2016 10:34 AM

Why do you think the results are wrong? I just ran your program with plots turned on, and everything looks fine for the fit. Taking out the weight statement gives a different confidence region, different SE, etc.,as expected. I think you just have a coincidence about the "0.1". For instance, I ran:

data b; set startdata;

pred = x**2;

SS = (y - pred)**2;

WSS = z*SS;

run;

proc means data=b sum;

var SS WSS;

run;

To manually get the sum of squares, weighted and unweighted, based on your parameter estimate. Weighted SS = 0.1, just like the NLIN output. If you run NLIN without the weight, you get SS = 1.0. This is what you get manually (above). I think everything is fine. By the way, put a plots=all option in your NLIN statement for good graphs.

Solution

02-01-2016
10:45 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2016 10:43 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2016 10:44 AM

Hi

There is an input error in my trial model: y1 should be 1 of course. However In my real problem this gives still some strange results. Thanks for the plots =all. It helps for my real problem

There is an input error in my trial model: y1 should be 1 of course. However In my real problem this gives still some strange results. Thanks for the plots =all. It helps for my real problem