Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- Programming
- /
- Re: how to make restriction work in PROC NLIN

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 11-25-2020 02:53 AM
(515 views)

I am running the regression y = a + b*x, by ID, with the restriction of a=0 and b>0.

In the PROC NLIN, the bounds statement requires inequality, so my code does not work.

1) if I simply set model = b*x (and delete a=0 in parameters and bounds statements), does that yield the result of a=0? seems like the result is desired, but I am not sure.

2) in the output dataset aa, _TYPE_ = "FINAL" are the estimated parameters, am I right?

Thank you and have a great holiday!

```
proc nlin data=sample outest=aa noprint;
parameters a=0 b=1;
bounds a=0, b>0;
model y = a + b*x;
by id;
output out=bb r=resid parms=a b;
run;
```

1 ACCEPTED SOLUTION

Accepted Solutions

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

Hi @JacAder,

@JacAder wrote:

Also, in the output dataset aa, _TYPE_ = "FINAL" are the estimated parameters, am I right?

Yes, the observation with _TYPE_="FINAL" would contain the final parameter estimates.

If parameter a is known to be zero, I would just simplify the model equation to y = b*x and not mention a anywhere in the step. Since y = b*x is a linear model (without an intercept), I would start with PROC REG or PROC GLM and use the NOINT option of the MODEL statement. If the estimated slope b is positive, the restriction is met. Otherwise, given that there are reasons to expect a positive slope, I would suspect one or more outliers to distort the estimation. I don't think that PROC NLIN with its BOUNDS statement would really help in this situation: The outliers would mislead PROC NLIN's algorithms as well and I would expect a poor model fit with an estimate of b close to zero. I'd rather investigate the suspected outliers (scatter plot, ...) and consider robust regression (PROC ROBUSTREG) to deal with them.

2 REPLIES 2

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

Hi @JacAder,

@JacAder wrote:

Also, in the output dataset aa, _TYPE_ = "FINAL" are the estimated parameters, am I right?

Yes, the observation with _TYPE_="FINAL" would contain the final parameter estimates.

If parameter a is known to be zero, I would just simplify the model equation to y = b*x and not mention a anywhere in the step. Since y = b*x is a linear model (without an intercept), I would start with PROC REG or PROC GLM and use the NOINT option of the MODEL statement. If the estimated slope b is positive, the restriction is met. Otherwise, given that there are reasons to expect a positive slope, I would suspect one or more outliers to distort the estimation. I don't think that PROC NLIN with its BOUNDS statement would really help in this situation: The outliers would mislead PROC NLIN's algorithms as well and I would expect a poor model fit with an estimate of b close to zero. I'd rather investigate the suspected outliers (scatter plot, ...) and consider robust regression (PROC ROBUSTREG) to deal with them.

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

Really appreciate your help!

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.