Obsidian | Level 7

## how to make restriction work in PROC NLIN

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

## Re: how to make restriction work in PROC NLIN

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

## Re: how to make restriction work in PROC NLIN

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.

Obsidian | Level 7