BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chrnie
Fluorite | Level 6

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!

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

9 REPLIES 9
data_null__
Jade | Level 19

Do you have model statement option CLPARM?

chrnie
Fluorite | Level 6

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?

Ksharp
Super User
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;

chrnie
Fluorite | Level 6

 

Thanks! The model that I run looks exactly like the example you posted. This is my output:

 

output.PNG

 

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

 

Ksharp
Super User
No. -10.70668 just is the lower confidence limit of yr*cohort PsA_K .
SteveDenham
Jade | Level 19

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

chrnie
Fluorite | Level 6

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:

CI of interaction.PNG

SteveDenham
Jade | Level 19

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

chrnie
Fluorite | Level 6

You are right. I must have done something wrong when I ran the model yesterday. This is the solution table:

solution.PNG

This is what I was after! Thanks a lot!

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
  • 9 replies
  • 1904 views
  • 1 like
  • 4 in conversation