Help with mixed model contrasts

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with mixed model contrasts

londonda
Hi,

I am running a mixed model for a repeated measures analysis.

I have two groups, with each group having 3 times points.

I know how to use syntax to do comparisons between individual group*time interactions, such as group1*time1 - group2*time2. What I am trying to do, and struggling with, is how to code the contrasts of (group1*time3 - group1*time1) - (group2*time3-group2*time1).

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Help with mixed model contrasts

Ryan
The TEST statement is your friend. Search the SPSS-L archives for many examples:


Ryan 

Sent from my iPhone

On Mar 4, 2013, at 3:18 PM, londonda <[hidden email]> wrote:

Hi,

I am running a mixed model for a repeated measures analysis.

I have two groups, with each group having 3 times points.

I know how to use syntax to do comparisons between individual group*time
interactions, such as group1*time1 - group2*time2. What I am trying to do,
and struggling with, is how to code the contrasts of (group1*time3 -
group1*time1) - (group2*time3-group2*time1).

Thanks!



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Help-with-mixed-model-contrasts-tp5718358.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Help with mixed model contrasts

Ryan
In reply to this post by londonda
The code BELOW my name generates data that conform to a 2 (conditions) X 3 (time points) linear mixed model with a compound symmetric structure to the residual variance-covariance matrix, after which the linear mixed model is employed on the simulated data via the MIXED procedure, along with the various TEST statements of interest.
 
Ryan
--

*Generate data.

set seed 65923454.

new file.
inp pro.
 
comp subject = -99.
comp condition = -99.
comp time = -99.

leave subject to time.
 
  loop subject= 1 to 1000.
  compute condition = rv.bernoulli(.50).
  compute #random_effect = sqrt(.30)*rv.normal(0,1).
 
  loop time = 1 to 3.
  compute y = 1.0 + 2.0*(condition=0)
                            + 2.5*(time=1) 
                            + 3.0*(time=2)
                            + 3.5*(condition=0)*(time=1)
                            + 4.0*(condition=0)*(time=2)
                            + #random_effect
                            + rv.normal(0,1).
 end case.
 end loop.
end loop.
end file.
end inp pro.
exe.
 
*Recode condition.
recode condition (0=1) (1=2).
exe.
 
*Fit Linear Mixed Model.
MIXED y BY condition time
  /FIXED=condition time condition*time | SSTYPE(3)
  /METHOD=REML
  /REPEATED=time | SUBJECT(subject) COVTYPE(CS)
  /EMMEANS=TABLES(condition*time)
  /PRINT=SOLUTION
  /TEST 'mean(c1,t1)' intercept 1 condition 1 0 time 1 0 0 condition*time 1 0 0 0 0 0
  /TEST 'mean(c1,t2)' intercept 1 condition 1 0 time 0 1 0 condition*time 0 1 0 0 0 0
  /TEST 'mean(c1,t3)' intercept 1 condition 1 0 time 0 0 1 condition*time 0 0 1 0 0 0
  /TEST 'mean(c2,t1)' intercept 1 condition 0 1 time 1 0 0 condition*time 0 0 0 1 0 0
  /TEST 'mean(c2,t2)' intercept 1 condition 0 1 time 0 1 0 condition*time 0 0 0 0 1 0
  /TEST 'mean(c2,t3)' intercept 1 condition 0 1 time 0 0 1 condition*time 0 0 0 0 0 1
  /TEST 'Diff1: mean(c1,t1) MINUS mean(c1,t2)' intercept 0 condition 0 0 time 1 -1  0 condition*time 1 -1  0  0  0  0
  /TEST 'Diff2: mean(c1,t1) MINUS mean(c1,t3)' intercept 0 condition 0 0 time 1  0 -1 condition*time 1  0 -1  0  0  0
  /TEST 'Diff3: mean(c1,t2) MINUS mean(c1,t3)' intercept 0 condition 0 0 time 0  1 -1 condition*time 0  1 -1  0  0  0
  /TEST 'Diff4: mean(c2,t1) MINUS mean(c2,t2)' intercept 0 condition 0 0 time 1 -1  0 condition*time 0  0  0  1 -1  0
  /TEST 'Diff5: mean(c2,t1) MINUS mean(c2,t3)' intercept 0 condition 0 0 time 1  0 -1 condition*time 0  0  0  1  0 -1
  /TEST 'Diff6: mean(c2,t2) MINUS mean(c2,t3)' intercept 0 condition 0 0 time 0  1 -1 condition*time 0  0  0  0  1 -1
  /TEST 'Diff1 MINUS Diff4' intercept 0 condition 0 0 time 0 0 0 condition*time 1 -1  0 -1  1  0
  /TEST 'Diff2 MINUS Diff5' intercept 0 condition 0 0 time 0 0 0 condition*time 1  0 -1 -1  0  1
  /TEST 'Diff3 MINUS Diff6' intercept 0 condition 0 0 time 0 0 0 condition*time 0  1 -1  0 -1  1.

On Mon, Mar 4, 2013 at 3:18 PM, londonda <[hidden email]> wrote:
Hi,

I am running a mixed model for a repeated measures analysis.

I have two groups, with each group having 3 times points.

I know how to use syntax to do comparisons between individual group*time
interactions, such as group1*time1 - group2*time2. What I am trying to do,
and struggling with, is how to code the contrasts of (group1*time3 -
group1*time1) - (group2*time3-group2*time1).

Thanks!



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Help-with-mixed-model-contrasts-tp5718358.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: Help with mixed model contrasts

londonda
Thanks you so much! I look forward to analyzing the code so that I
understand how to do this analysis in the future.


On 3/4/2013 4:39 PM, Ryan Black [via SPSSX Discussion] wrote:
> MIXED y BY condition time
>   /FIXED=condition time condition*time | SSTYPE(3)
>   /METHOD=REML
>   /REPEATED=time | SUBJECT(subject) COVTYPE(CS)
>   /EMMEANS=TABLES(condition*time)