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

I have to run this linear regression

y = a +b1 x1 + b2 x2 +u

with b1, b2 >0  and b1+b2=1

proc reg would be perfect but it doesn't accept inequality constraints.

viceversa, proc nlin would be ok but it doesn't accept equality constraints.

one possibility would be proc nlin with

y= a + exp(c1) x1 + (1-exp(c1)) x2 + u

Do you have a better solution?

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

bounds 0 < a1 < a2 < a3 < 1;
y = a0 + a1*x1 + (a2-a1)*x2 + (a3-a2)*x3 + (1-a3)*x4;

PG

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

In proc nlin, use bounds

 

bounds 0 < C < 1;

 

and equation

 

y = a + C x1 + (1-C) x2 + u;

 

PG
riccardo85
Calcite | Level 5

thank you but with 3 (or more) parameters?

y=a0+ a1 x1 + a2 x2 + a3 x3

 

becomes

y= a0 + a1 x1 +a2 x2 + (1-a1-a2) x3

bounds 0< a1 < 1

bounds 0 < a2 <1

 

and the constraint  0 < a3 < 1 ?

 

 

 

PGStats
Opal | Level 21

bounds 0 < a1 < a2 < a3 < 1;
y = a0 + a1*x1 + (a2-a1)*x2 + (a3-a2)*x3 + (1-a3)*x4;

PG
Ksharp
Super User

proc hpgenselect;
class A;
model y/n = A x / dist=binomial;
restrict A 1 0 -1;
restrict x 2 >= 0.5;
run;


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!

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.

Discussion stats
  • 4 replies
  • 2067 views
  • 1 like
  • 3 in conversation