- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hey everyone at SAS,
My question very simple OK. I have regression with just continuous variable, no CLASS variable.
proc glm data=in;
model y = x ;
run;
quit;
At specific values of x, I can predict y and have confidence interval for prediction. x1=12 and x2=10 I know the predicted value and the confidence interval around each prediction. But my question how I find confidence interval for the prediction at x1 minus the prediction at x2?
This is what I want to do; find the confidence interval around the difference in predicted values? I have tried using estimate and contrast but not working for a difference in predicted value.
Really appreciate help!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Start with your fitted model: mean(y)=b0 + b1*x. Using this model, the prediction at x=12 is b0+b1*12. At x=10, it is b0+b1*10. Now, take the difference: mean(y,x=12)-mean(y,x-10)=(b0+b1*12)-(b0+b1*10)=b1*(12-10)=2*b1. Any linear combination of model parameters can be estimated using ESTIMATE statement. For regression models like this, it is best to use PROC ORTHOREG as it is the most modern and supports the full range of modern statements, unlike the old GLM and REG procedures.
proc orthoreg;
model y=x;
estimate 'diff 12-10' x 2 / cl;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Start with your fitted model: mean(y)=b0 + b1*x. Using this model, the prediction at x=12 is b0+b1*12. At x=10, it is b0+b1*10. Now, take the difference: mean(y,x=12)-mean(y,x-10)=(b0+b1*12)-(b0+b1*10)=b1*(12-10)=2*b1. Any linear combination of model parameters can be estimated using ESTIMATE statement. For regression models like this, it is best to use PROC ORTHOREG as it is the most modern and supports the full range of modern statements, unlike the old GLM and REG procedures.
proc orthoreg;
model y=x;
estimate 'diff 12-10' x 2 / cl;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you StatDave. I no have othoreg. I have this code
proc glm data=test;
model y=x / solution cli clm;
estimate 'difference' x / e;
run;
How I make it give confidence limit?
Thank you for help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is the confidence limit (from estimate statement) a confidence limit around the linear combination of parameters or around the predicted difference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The ESTIMATE statement estimates the difference, so the CL option provides the confidence interval for that difference. This is true for the ordinary regression model, but note that for a generalized linear model (logistic, Poisson, gamma, etc.) this would not be true. For a generalized linear model that uses a non-identity link function, that ESTIMATE statement would not estimate the difference in means at the two settings and the confidence interval would also not be for that difference.