BookmarkSubscribeRSS Feed
FB1
Calcite | Level 5 FB1
Calcite | Level 5

Hello everybody,

   is it possible to add boundaries in proc quantreg?

Here's my code:

 

proc quantreg 	data=d
			algorithm=simplex outest=out ci=sparsity plots=none;
			model y= x1 x2 x3 / quantile=&q.;
			output out=out p=q res=r;
run;

I would like to add the following condiiton on y: 

 

 

y>=0

 

Thanks a lot.

5 REPLIES 5
Rick_SAS
SAS Super FREQ

Can you clarify? Do you want

1. To only build the model for observations that have y >= 0.  If so, insert

    WHERE y>=0;

before the MODEL statement.

2. To build a model that predicts only positive values. If so, you need to build a model that reflects that restriction. To do this correctly requires knowledge of the data and errors.

 

For example, to expand on (2), if all the observed Ys are positive, you can define LogY = log(Y) and then model LogY. The predictions of Y are obtained from the predictions of LogY by exponentiating, Therefore the predictions are always positive. If you are interested in learning more, read "Error distributions and exponential regression models."

FB1
Calcite | Level 5 FB1
Calcite | Level 5

Thanks for you answer.

 

It's option 2., I need to build a model that predicts only positive values, but my Ys observed are both positive and negative.

 

I will absolutely read the article you suggest.

 

In the meanwhile, thanks again.

FB1
Calcite | Level 5 FB1
Calcite | Level 5

Would it make sense to put a floor (to 0) on observed Ys and then build a model on log(Y) as you suggested?

Rick_SAS
SAS Super FREQ

No, that transformation won't work because log(y) is not defined for y <= 0.

FB1
Calcite | Level 5 FB1
Calcite | Level 5

Sorry, I meant 0+

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 5 replies
  • 1681 views
  • 0 likes
  • 2 in conversation