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

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
FreelanceReinh
Jade | Level 19

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.

 

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

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.

 

JacAder
Obsidian | Level 7
Really appreciate your help!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1253 views
  • 0 likes
  • 2 in conversation