BookmarkSubscribeRSS Feed
ArseneWenger
Fluorite | Level 6

Is there a way in SAS regression procedures to cap lower bound of predicted values.

I would like to know if there is a way or option that can be used to adjust that in the procedure itself.

 

I have a scenario in which predicted negative values would practically never happen and I want to adjust that in regression itself.

 

Please let me know if anyone knows a way to handle that.

6 REPLIES 6
ballardw
Super User

You might mention which specific regression procedures you are using. It won't help you much if someone comes back with a technique that only works in one or two procedures and those are not the regressions you are using.

ArseneWenger
Fluorite | Level 6

I am using Proc Reg right now but couldn't find any option to cap. Are there any other regression procedure that does that?

Rick_SAS
SAS Super FREQ

The general technique is to choose an appropriate model for the response. For example, if the response is a nonnegative count, use Poisson regression. If you are using a linear model such as OLS, then the model will produce negative values when the data call for it.

 

For a continuous response, you can use a LOG link function to prevent negative predictions, but realize that you are changing the model.

Rick_SAS
SAS Super FREQ

To answer your question: no, I do not believe that SAS supports any option that truncates the predicted values.

Truncating predictions like that would not fit an OLS model.

 

I think the right thing to do is choose a model that makes sense for your data. Can you describe your data and the problem that you are trying to solve?

ballardw
Super User

Generally I would output the predicted values and then post process the results in a data step as needed. I do this with confidence limit predictions on a regular basis. My data is proportion and one of the limits sometimes exceeds the [0%,100%] range that makes sense. Since I do this fairly frequently I have a custom format to force values less than 0 to display as 0 and greater than 100 as 100.

 

With a format I could even include an explanatory symbol to indicate a truncated result to let readers know.

If the value needs to be used in further calculations than the data step boundary would be see with something like:

 

if pred<0 then pred=0;

else if pred>(some maximum value) then pred=(maximum value).

Rick_SAS
SAS Super FREQ

IMHO, there is a big difference between adjusting confidence limits (which are probably based derived from an asymptotic normal theory) and adjusting predicted values. If you adjust the predicted values, the model is no longer linear; it becomes piecewise linear (or worse?)

 

If you don't want to move to a generalized linear model, at least consider whether you can use the NOINT option or RESTRICT statement to restrict the intercept term. 

 

Good luck!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1677 views
  • 3 likes
  • 3 in conversation