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
- /
- Help on Constraint Linear Regression

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

04-14-2014 06:54 AM

Hi, I wanted to set a constraint on a linear regression model (y = b0+b1*x1+b2*x2+e), such that the the predicted value (b0+b1*x1+b2*x2) is positive. Is there a SAS procedure that can be used for the purpose. Any help is greatly appreciated!

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

Posted in reply to FelixHugh

04-14-2014 09:08 AM

Easy way: Fit log(y) and back transform.

More difficult way: Use PROC MODEL with a RESTRICT statement. I know it can be done, but I have never tried it myself.

Steve Denham

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

Posted in reply to SteveDenham

04-14-2014 10:05 AM

Thank you Steve for your suggestions!

I did try PROC MODEL. I found it difficult to set up a RESTRICT statement for the purpose of bounding all the predicted values of y as positive.

I tried to use log(y) as the dependent variable, but the parameter estimates are not close to the values from the paper, which I was trying to replicate.

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

Posted in reply to SteveDenham

04-14-2014 10:15 AM

Doc Steve,

If I want all the coefficient ( b0 b1 b2) greater than zero. what I am going to do ?

Best.

Xia Keshan

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

Posted in reply to Ksharp

04-14-2014 10:21 AM

Hi, sorry to just jump in. I think you may try to set multiple RESTRICT statements (restrict b0>0, b1>0, b2>0).

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

Posted in reply to Ksharp

04-14-2014 11:07 AM

The RESTRICT statement in PROC REG only handles equality constraints, but you can use the BOUNDS statement in PROC NLIN to restrict the range of the parameters.

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

Posted in reply to FelixHugh

04-14-2014 10:06 AM

As stated, your problem is impossible unless b1=b2=0 and b0>0. Otherwise there will always be a value of (x1, x2) for which the predicted value will be negative.

If you know that (x1,x2) are restricted to some domain (like the unit square), then it is possible.

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

Posted in reply to Rick_SAS

04-14-2014 10:17 AM

Thank you Rick for your reply!

The dependent variable is variance in stock market returns, which is why I want to make sure the predicted variance is positive.

The independent variables include variance and market return from last period. Market return can be negative.

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

Posted in reply to FelixHugh

04-14-2014 11:01 AM

In survival analysis, logistic regression, Poisson regression, and other models, the linear portion of the model is transformed by a "link function" to ensure that the result is positive.

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

Posted in reply to Rick_SAS

04-14-2014 03:14 PM

Because your response variable is a variance, I recommend that you model it as a gamma distribution, with a log link. That is, use GENMOD or GLIMMIX, and choose dist=gamma and link=log. The gamma often works very well as an approximation for the true distribution of a variance at small (finite) sample sizes. You can still get predictions for the original scale in an output file. For instance,

proc glimmix ;

model var = .... / dist=gamma link=log s ;

output out=pred pred(blup ilink)=predicted;

run;

There are many other options for the output file.

Schabenberger and Pierce (2002 textbook) give an example of a regression analysis of a variance dependent variable using this idea (but with GENMOD).

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

04-14-2014 03:53 PM

Thank you very much!

I will try that.

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

Posted in reply to Rick_SAS

04-14-2014 10:19 AM

Doc Rick.

What about survival analysis ? in Survival Analysis , dependent variable(survival time) is always > 0.