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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Just add the diff option to the lsmeans statement.

View solution in original post

6 REPLIES 6
Reeza
Super User

Have you tried adding CL to your MODEL statement?

 

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

 

tinaning
Calcite | Level 5

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

SteveDenham
Jade | Level 19

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

tinaning
Calcite | Level 5

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.

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Just add the diff option to the lsmeans statement.

tinaning
Calcite | Level 5

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 6 replies
  • 14328 views
  • 0 likes
  • 4 in conversation