Hi,
I am running a simple linear regression in proc glm:
y = x + a + x*a,
where y is days of sickness absence per year, x is calendar year (treated as a continuous variable) and a a cohort effect (two categories). I would like to know whether the change in y over the time is different for my two cohorts. I have the estimates for my two slopes and so far I am fine. However, I get stuck when I try to get the 95% confidence intervals to go with each of the estimates.
Could someone help me out? Thanks in advance!
Good looking graph, so things seem to be going OK.
The NOTE you referred to really is about the calculation of Rsquared under a no-intercept model, and gets fired in whenever the NOINT option is executed. What should be interesting would be the solution table generated. That should have the intercepts and slope coefficients, now expressed directly rather than as deviations. And with the CLPARM option, you should have 95% confidence limits for them, so there should be no need to manipulate the results from the full factorial model.
Steve Denham
Do you have model statement option CLPARM?
Yes I do. Sorry for being a bit vague. The question is more about what to do with the output - do I add the confidence limits of the treatment group with those of the reference group in the same way as I did to get the parameter estimate?
You need SOLUTION option too because you have CLASS variable. proc glm data=sashelp.class; class sex; model weight=sex age sex*age/solution clparm; run;
Thanks! The model that I run looks exactly like the example you posted. This is my output:
How do I go from here to the confidence interval of yr*cohort PsA_K? Do I add -3.81090 and -10.70668 to get the lower confidence limit (and similarly for the upper confidence limit)?
What do you get if you try fitting the following (with obvious changes to your data):
proc glm data=sashelp.class;
class sex;
model weight=sex sex*age/noint solution clparm;
quit;
run;
This should give unique and non-biased estimates for the intercepts (sex in this case) and for the separate slopes for each sex, rather than the deviations from the reference level intercept and slope.
Steve Denham
Steve: I tried fitting the model according to your suggestion. The log gives me the following note:
NOTE: Due to the presence of CLASS variables, an intercept is implicitly fitted. R-Square has
been corrected for the mean.
I have done some research myself and have realized that, when dealing with interactions, the confidence interval will depend on the level of the covariate (please correct me if I am wrong!). I found this code for proc plm that provides the confidence intervals that I was after (graphically):
proc plm resore=PsA_K_est;
effectplot slicefit (x=yr sliceby=cohort) / clm;
run;
And this is what the result looks like:
Good looking graph, so things seem to be going OK.
The NOTE you referred to really is about the calculation of Rsquared under a no-intercept model, and gets fired in whenever the NOINT option is executed. What should be interesting would be the solution table generated. That should have the intercepts and slope coefficients, now expressed directly rather than as deviations. And with the CLPARM option, you should have 95% confidence limits for them, so there should be no need to manipulate the results from the full factorial model.
Steve Denham
You are right. I must have done something wrong when I ran the model yesterday. This is the solution table:
This is what I was after! Thanks a lot!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.