Solved
New Contributor
Posts: 4

# Getting confidence interval in PROC MIXED

Hello all,

I'm running mixed models using PROC MIXED.

Here are my codes:

``````proc mixed data=try covtest;
class month pid;
model outc=age male month|treatment / s;
random int / subject=pid;
run;``````

Results:

``````                                                              Standard
Effect                       month   Estimate      Error     DF   t Value   Pr > |t|

treatment                              4.8044     0.7133   12E3      6.74     <.0001
treatment*month                  4    -4.6793     1.1857   12E3     -3.95     <.0001
treatment*month                  5    -3.3753     0.8922   12E3     -3.78     0.0002
treatment*month                  6    -2.9591     0.8697   12E3     -3.40     0.0007
treatment*month                  7    -0.3250     0.8824   12E3     -0.37     0.7126
treatment*month                  8          0          .      .       .        .``````

I want to get the treatment effects in each month, i.e. 4.8 + (-4.7) = 0.1 in month 4, 4.8 + (-3.4) = 1.4 in month 5. Is there any way to get confidence intervals for the calculated values (0.1, 1.4, etc)?

Accepted Solutions
Solution
‎02-15-2016 05:14 PM
Valued Guide
Posts: 684

## Re: Getting confidence interval in PROC MIXED

Just add the diff option to the lsmeans statement.

All Replies
Super User
Posts: 20,735

## Re: Getting confidence interval in PROC MIXED

[ Edited ]

``model outc=age male month|treatment / s CL;``

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect0...

 CL displays confidence limits for fixed-effects parameter estimates

New Contributor
Posts: 4

## Re: Getting confidence interval in PROC MIXED

It only gives CI for each fixed parameter estimates, I need CI for the linear combination, i.e. 4.8+(-4.7)=0.1

Posts: 2,655

## Re: Getting confidence interval in PROC MIXED

[ Edited ]

Use the LSMEANS statement, with a CL option.

```proc mixed data=try covtest;
class month treatment pid; /*notice that I have added treatment as a class effect */
model outc=age male month|treatment / s;
random int / subject=pid;
LSMEANS month*treatment/cl;
run;```

Steve Denham

New Contributor
Posts: 4

## Re: Getting confidence interval in PROC MIXED

Thanks Steve.

I tried your codes, LSMEANS show CI for the means of the outcome variable in each specified groups, not exactly what I was trying to calculate.

I want to get CI for 4.8+(-4.7)=0.1. It won't be significant if CI spans zero.

Solution
‎02-15-2016 05:14 PM
Valued Guide
Posts: 684

## Re: Getting confidence interval in PROC MIXED

Just add the diff option to the lsmeans statement.

New Contributor
Posts: 4

## Re: Getting confidence interval in PROC MIXED

[ Edited ]

Great! I got it right, thanks Steve and lvm.

Here are my complete codes for share.

``````ods output diffs=diffdata;
proc mixed data=try covtest;
class month pid treatment;
model outc=age male month|treatment / s;
lsmeans month*treatment / cl diff;
random int / subject=pid;
run;``````
☑ This topic is solved.