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

Hello sas users

Can anyone help me estimate OLS with restriction?

 

My model is

Y=b0+b1*x1+b2*x2+b3*x3

 

I want to impose restrictions where

(i) b1,b2,b3>=0 

(ii) b1+b2+b3=1

 

Which procedure do I use?

If you let me know it will be really appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions
jkim197
Obsidian | Level 7

proc model data=loading_&howmany(where=(year(date)=&i)) plots=none;
by wficn date;
retmrf=b0+b1*rm+b2*smb+b3*hml+b4*umd ;
bounds 0 <= b1 b2 b3 b4;
restrict b1+b2+b3+b4 = 1;
fit retmrf ;
ods output ResidSummary=rsq_&howmany._&i(keep=wficn date RSquare);
run;
quit;

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

PROC REG with the RESTRICT statement can handle your second restriction, but not the first (because PROC REG cannot handle greater than or less than restrictions).


Then there's this: https://communities.sas.com/t5/Statistical-Procedures/Regression-analysis-with-only-positive-coeffic... (scroll down to the reply by @stanmarciano 

 

I believe you can program PROC IML to handle greater than or less than restrictions on the regression coefficients, but I leave that up to our in-house PROC IML author @Rick_SAS

--
Paige Miller
jkim197
Obsidian | Level 7

Thanks but I didnt mean to do Bayesian inference

PaigeMiller
Diamond | Level 26

And this: https://support.sas.com/kb/22/800.html

 

Remember, Google is your friend in situations like this.

--
Paige Miller
PGStats
Opal | Level 21

Replace b3 with 1 - b1 - b2 in your model and use proc nlin to fit your model with a bounds statement.

PG
Ksharp
Super User

Check @Rick_SAS  blog ,about this question.

 

jkim197
Obsidian | Level 7

proc model data=loading_&howmany(where=(year(date)=&i)) plots=none;
by wficn date;
retmrf=b0+b1*rm+b2*smb+b3*hml+b4*umd ;
bounds 0 <= b1 b2 b3 b4;
restrict b1+b2+b3+b4 = 1;
fit retmrf ;
ods output ResidSummary=rsq_&howmany._&i(keep=wficn date RSquare);
run;
quit;

Rick_SAS
SAS Super FREQ

For more about solving regression problems in SAS that have constraints on the parameters, see

sas-innovate-2024.png

Available on demand!

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

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 675 views
  • 6 likes
  • 5 in conversation