Programming the statistical procedures from SAS

Capping predictions using SAS/STAT prodecures

Reply
Occasional Contributor
Posts: 8

Capping predictions using SAS/STAT prodecures

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.

Grand Advisor
Posts: 10,043

Re: Capping predictions using SAS/STAT prodecures

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.

Occasional Contributor
Posts: 8

Re: Capping predictions using SAS/STAT prodecures

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

SAS Super FREQ
Posts: 3,307

Re: Capping predictions using SAS/STAT prodecures

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.

SAS Super FREQ
Posts: 3,307

Re: Capping predictions using SAS/STAT prodecures

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?

Grand Advisor
Posts: 10,043

Re: Capping predictions using SAS/STAT prodecures

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).

SAS Super FREQ
Posts: 3,307

Re: Capping predictions using SAS/STAT prodecures

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!

Ask a Question
Discussion stats
  • 6 replies
  • 127 views
  • 3 likes
  • 3 in conversation