Programming the statistical procedures from SAS

Confidence intervals of continuous-by-class effect

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Confidence intervals of continuous-by-class effect

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!


Accepted Solutions
Solution
‎06-17-2016 02:55 AM
Respected Advisor
Posts: 2,655

Re: Confidence intervals of continuous-by-class effect

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


All Replies
Respected Advisor
Posts: 3,773

Re: Confidence intervals of continuous-by-class effect

Do you have model statement option CLPARM?

Occasional Contributor
Posts: 5

Re: Confidence intervals of continuous-by-class effect

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?

Grand Advisor
Posts: 9,463

Re: Confidence intervals of continuous-by-class effect

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;

Occasional Contributor
Posts: 5

Re: Confidence intervals of continuous-by-class effect

 

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

 

Grand Advisor
Posts: 9,463

Re: Confidence intervals of continuous-by-class effect

No. -10.70668 just is the lower confidence limit of yr*cohort PsA_K .
Respected Advisor
Posts: 2,655

Re: Confidence intervals of continuous-by-class effect

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

Occasional Contributor
Posts: 5

Re: Confidence intervals of continuous-by-class effect

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

Solution
‎06-17-2016 02:55 AM
Respected Advisor
Posts: 2,655

Re: Confidence intervals of continuous-by-class effect

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

Occasional Contributor
Posts: 5

Re: Confidence intervals of continuous-by-class effect

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!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 296 views
  • 1 like
  • 4 in conversation