Understanding three-way interactions in MIXED

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

Understanding three-way interactions in MIXED

nanditav
Hi all,

I have a three-way interaction between a continuous and two categorical (2-levels each) variables using MIXED in SPSS. I was wondering if it was possible to use the TEST subcommand to compare slopes at -1sd and +1SD of the continuous variable? Any help would be really appreciated. I've been stuck on this problem for quite a while now.

Thank you!

Nandi
Reply | Threaded
Open this post in threaded view
|

Re: Understanding three-way interactions in MIXED

Ryan
Nandi,
 
Why would you expect your [presumably] estimated linear slope between the covariate and the DV to change at different levels of your covariate? That does not make sense to me. I need you to break this down a bit further. How do you factor in the two categorical variables into your question?
 
I would have expected you to ask something like, "What's the difference between the slope of the covariate and the DV at FactorA=1,FactorB=1 and the slope of the covariate and the DV at FactorA=2,FactorB=2?"
 
Ryan
On Wed, Mar 20, 2013 at 6:50 PM, nanditav <[hidden email]> wrote:
Hi all,

I have a three-way interaction between a continuous and two categorical
(2-levels each) variables using MIXED in SPSS. I was wondering if it was
possible to use the TEST subcommand to compare slopes at -1sd and +1SD of
the continuous variable? Any help would be really appreciated. I've been
stuck on this problem for quite a while now.

Thank you!

Nandi



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Understanding-three-way-interactions-in-MIXED-tp5718921.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: Understanding three-way interactions in MIXED

Ryan
I meant to say that a typical question would be something like: "What's the difference between the slope of the covariate and the DV at FactorA=1,FactorB=1 and the slope of the covariate and the DV at FactorA=1,FactorB=2?"
 
That is, for a three-way interaction, it is common practice to compare slopes holding a level of one of the factors constant, while changing the levels of the other factor.
 
Again, I need you to clarify your question in order for me to help you parameterize the model correctly and build the correct TEST statement(s).

Ryan
 
On Wed, Mar 20, 2013 at 10:16 PM, R B <[hidden email]> wrote:
Nandi,
 
Why would you expect your [presumably] estimated linear slope between the covariate and the DV to change at different levels of your covariate? That does not make sense to me. I need you to break this down a bit further. How do you factor in the two categorical variables into your question?
 
I would have expected you to ask something like, "What's the difference between the slope of the covariate and the DV at FactorA=1,FactorB=1 and the slope of the covariate and the DV at FactorA=2,FactorB=2?"
 
Ryan
On Wed, Mar 20, 2013 at 6:50 PM, nanditav <[hidden email]> wrote:
Hi all,

I have a three-way interaction between a continuous and two categorical
(2-levels each) variables using MIXED in SPSS. I was wondering if it was
possible to use the TEST subcommand to compare slopes at -1sd and +1SD of
the continuous variable? Any help would be really appreciated. I've been
stuck on this problem for quite a while now.

Thank you!

Nandi



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Understanding-three-way-interactions-in-MIXED-tp5718921.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: Understanding three-way interactions in MIXED

nanditav
Hi Ryan,

Thanks for getting back to me. I see what you mean, and now think my question might be more basic than constructing contrasts. I am analyzing longitudinal data collected at two time points. At each time point, I have cognitive data (i.e. reaction time) and brain data (i.e. brain thickness). I am interested in analyzing how change in cognition and change in brain are related. Currently, I have calculated a percentage change score for the brain data and used that as a continuous variable within models analyzing the cognition data. For example, DV = reaction time, IVs = time (coded as 0,1), gender (0,1) and brain change (percentage change score).

I found a significant three-way interaction and proceeded to split the sample into males and females. I did not identify a significant two-way interaction in either group, however plotting the results showed that the direction of association between time and brain change is opposite in males and females, and appears to be stronger in females. I guess my question now is simply whether this is enough post-hoc analyses to pull apart the three-way interaction?

Thank you,

Nandi
Reply | Threaded
Open this post in threaded view
|

Re: Understanding three-way interactions in MIXED

Ryan
Nandi,
 
I think I understand what you are asking. Here's how I would state the formal research question:
 
"Is there a significant difference in slopes of "brain change" and change in reaction time between males and females?"
 
If my math is correct, then the code below should produce a formal test on the research question above.
MIXED y BY Gender Time with BrainChange
  /FIXED=Gender Gender*Brainchange Gender*Time Gender*Time*Brainchange | NOINT SSTYPE(3)
  /PRINT SOLUTION
  /METHOD=REML
  /REPEATED=time | SUBJECT(ID) COVTYPE(CS)
  /TEST = 'Diff in Gender-specific slopes' Gender*Time*BrainChange 1 -1 -1 1.
 
The last two non-redundant parameter estimates in the Solution for Fixed Effects Table should be the estimated gender-specific slopes. and the TEST sub-command is performing a formal statistical test on the difference between those estimates.
 
Qualifying statements:
1. I prefer not to comment on whether you are measuring each variable accurately and building the appropriate design. That is for you to decide.
2. I am assuming that a simple compound symmetric residual structure should suffice, which is probably reasonable since you only have two time points; this is something that should be evaluated.
3. The code is untested.
 
HTH,
 
Ryan
 
On Wed, Mar 20, 2013 at 11:51 PM, nanditav <[hidden email]> wrote:
Hi Ryan,

Thanks for getting back to me. I see what you mean, and now think my
question might be more basic than constructing contrasts. I am analyzing
longitudinal data collected at two time points. At each time point, I have
cognitive data (i.e. reaction time) and brain data (i.e. brain thickness). I
am interested in analyzing how change in cognition and change in brain are
related. Currently, I have calculated a percentage change score for the
brain data and used that as a continuous variable within models analyzing
the cognition data. For example, DV = reaction time, IVs = time (coded as
0,1), gender (0,1) and brain change (percentage change score).

I found a significant three-way interaction and proceeded to split the
sample into males and females. I did not identify a significant two-way
interaction in either group, however plotting the results showed that the
direction of association between time and brain change is opposite in males
and females, and appears to be stronger in females. I guess my question now
is simply whether this is enough post-hoc analyses to pull apart the
three-way interaction?

Thank you,

Nandi



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Understanding-three-way-interactions-in-MIXED-tp5718921p5718928.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: Understanding three-way interactions in MIXED

Ryan
Nandi,
 
I'm not sure if you are still reading my posts, but I must make a statement about an assumption I made. I assumed based on your definition of the variable, "brain change (percentage change score)," that it was/is a time-invariant independent variable. In plain English, I assume you took the differene between time points and inserted that % change difference score as the value at each time point in your vertical file:
 
ID Time BrainChange ...
1   1      2.1
1   2      2.1
2   1      3.4
2   2      3.4
.
.
.
 
I can't imagine a variable defined as "percent change score" for a design with two time points varying across time points, but I figured I would write back just in case my assumption was erroneous. 
 
Ryan
 
On Sat, Mar 23, 2013 at 1:48 PM, R B <[hidden email]> wrote:
Nandi,
 
I think I understand what you are asking. Here's how I would state the formal research question:
 
"Is there a significant difference in slopes of "brain change" and change in reaction time between males and females?"
 
If my math is correct, then the code below should produce a formal test on the research question above.
MIXED y BY Gender Time with BrainChange
  /FIXED=Gender Gender*Brainchange Gender*Time Gender*Time*Brainchange | NOINT SSTYPE(3)
  /PRINT SOLUTION
  /METHOD=REML
  /REPEATED=time | SUBJECT(ID) COVTYPE(CS)
  /TEST = 'Diff in Gender-specific slopes' Gender*Time*BrainChange 1 -1 -1 1.
 
The last two non-redundant parameter estimates in the Solution for Fixed Effects Table should be the estimated gender-specific slopes. and the TEST sub-command is performing a formal statistical test on the difference between those estimates.
 
Qualifying statements:
1. I prefer not to comment on whether you are measuring each variable accurately and building the appropriate design. That is for you to decide.
2. I am assuming that a simple compound symmetric residual structure should suffice, which is probably reasonable since you only have two time points; this is something that should be evaluated.
3. The code is untested.
 
HTH,
 
Ryan
 
On Wed, Mar 20, 2013 at 11:51 PM, nanditav <[hidden email]> wrote:
Hi Ryan,

Thanks for getting back to me. I see what you mean, and now think my
question might be more basic than constructing contrasts. I am analyzing
longitudinal data collected at two time points. At each time point, I have
cognitive data (i.e. reaction time) and brain data (i.e. brain thickness). I
am interested in analyzing how change in cognition and change in brain are
related. Currently, I have calculated a percentage change score for the
brain data and used that as a continuous variable within models analyzing
the cognition data. For example, DV = reaction time, IVs = time (coded as
0,1), gender (0,1) and brain change (percentage change score).

I found a significant three-way interaction and proceeded to split the
sample into males and females. I did not identify a significant two-way
interaction in either group, however plotting the results showed that the
direction of association between time and brain change is opposite in males
and females, and appears to be stronger in females. I guess my question now
is simply whether this is enough post-hoc analyses to pull apart the
three-way interaction?

Thank you,

Nandi



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Understanding-three-way-interactions-in-MIXED-tp5718921p5718928.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: Understanding three-way interactions in MIXED

nanditav
Hi Ryan,

Yes, your assumptions regarding my covariate being time invariant are also correct. Thank you very much for the test contrast, this really helps!

Nandi
Reply | Threaded
Open this post in threaded view
|

Re: Understanding three-way interactions in MIXED

Ryan
Good to know. Thank you for responding. The following code might be interesting to those who are wondering about the recommended way in which I parameterized the model, and how it compares to the usual parameterization of the same model. At the very end, I even throw in a model on change scores for fun. :-)
 
*Generate data.
set seed 4836235.
new file.
inp pro.
   comp ID = -99.
   comp random_effect = -99.
   comp Gender = -99.
   comp Brainchange = -99.
   comp Time = -99.
 
leave ID to Time.
 
      loop ID = 1 to 500.
      comp random_effect = sqrt(0.30)*rv.normal(0,1).
      comp Gender = rv.bernoulli(0.50).
      comp BrainChange = rv.uniform(1,100).
 
      loop Time = 1 to 2.
      comp y = 1.0 + 1.0*Gender
                          + 1.5*Time
                          + 2.0*BrainChange
                          + 3.0*Gender*Time
                          + 3.4*Gender*BrainChange
                          + 4.0*Time*BrainChange
                          + 4.5*Gender*Time*BrainChange
                          + random_effect
                          + rv.normal(0,1).
         end case.
      end loop.
    end loop.
end file.
end inp pro.
exe.
 
*Traditional Parameterization.
MIXED y BY Gender Time with BrainChange
  /FIXED=Gender Time BrainChange Gender*Time Gender*BrainChange Time*BrainChange
    Gender*Time*Brainchange | SSTYPE(3)
  /PRINT SOLUTION
  /METHOD=REML
  /REPEATED=Time | SUBJECT(ID) COVTYPE(CS).
 
*Alternative Parameterization of the same model above.
MIXED y BY Gender Time with BrainChange
  /FIXED=Gender Gender*Brainchange Gender*Time Gender*Time*Brainchange | NOINT SSTYPE(3)
  /PRINT SOLUTION
  /METHOD=REML
  /REPEATED=time | SUBJECT(ID) COVTYPE(CS)
  /TEST = 'Diff in Gender-specific slopes' Gender*Time*BrainChange 1 -1 -1 1.
 
AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=ID
  /y_first=FIRST(y)
  /y_last=LAST(y).
 
COMPUTE y_change_score=y_first - y_last.
EXECUTE.
 
* Identify Duplicate Cases.
SORT CASES BY ID(A).
MATCH FILES
  /FILE=*
  /BY ID
  /FIRST=PrimaryFirst
  /LAST=PrimaryLast.
DO IF (PrimaryFirst).
COMPUTE  MatchSequence=1-PrimaryLast.
ELSE.
COMPUTE  MatchSequence=MatchSequence+1.
END IF.
LEAVE  MatchSequence.
FORMATS  MatchSequence (f7).
COMPUTE  InDupGrp=MatchSequence>0.
SORT CASES InDupGrp(D).
MATCH FILES
  /FILE=*
  /DROP=PrimaryFirst InDupGrp MatchSequence.
VARIABLE LABELS  PrimaryLast 'Indicator of each last matching case as Primary'.
VALUE LABELS  PrimaryLast 0 'Duplicate Case' 1 'Primary Case'.
VARIABLE LEVEL  PrimaryLast (ORDINAL).
FREQUENCIES VARIABLES=PrimaryLast.
EXECUTE.
 
USE ALL.
COMPUTE filter_$=(PrimaryLast=1).
VARIABLE LABELS filter_$ 'PrimaryLast=1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.
 
*Compare the estimates from this model on the change scores to the alternative parameterization of the other model above.
MIXED y_change_score by Gender with BrainChange
  /FIXED=Gender Gender*BrainChange| NOINT SSTYPE(3)
  /PRINT SOLUTION
  /METHOD=REML.
 
On Sun, Mar 24, 2013 at 9:48 PM, nanditav <[hidden email]> wrote:
>
> Hi Ryan,
>
> Yes, your assumptions regarding my covariate being time invariant are also
> correct. Thank you very much for the test contrast, this really helps!
>
> Nandi
>
>
>
> --
> 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: Understanding three-way interactions in MIXED

nanditav
Hi Ryan,

I have a quick follow-up question. I notice that your traditional model does include intercepts for the fixed effects, but your alternate models do not. I'm wondering why this is the case? Do I have to exclude intercepts in all situation when between-group comparisons are made?

Nandi
Reply | Threaded
Open this post in threaded view
|

Re: Understanding three-way interactions in MIXED

Ryan
Hi Nandi,
 
Let's be clear. The two models BELOW presented previously are mathematically equivalent. They are simply different parameterizations of the same model. Look at the number of estimated parameters, the fit criteria, the estimated residual variance-covariance estimates, etc. They are identical! Even careful inspection of the Fixed Effects estimates provides further evidence, but I won't go into detail right now how to examine the Fixed Effects estimates to evaluate equivalence.
 
If the models are the same, then which one is preferred? It is a matter of your research question and convenience. Do you want the see the gender-specific slopes in the Fixed Effects estimates Table without any manipulation? If so, the alternate parameterization is preferred. Recall that I said the last two non-redundant parameter estimates in the alternative parameterization provides those gender-specific slopes. Quite convenient, don't you think?
 
For the record, the "Traditional Parameterization" has a single grand intercept, while the "Alternative Parameterization" has more than 1 intercept.
 
Let me leave you with a piece of advice.
Forget about mixed models for a while, and take time studying linear regression/general linear models, starting with a single binary categorical predictor (coded 0/1). What does the grand intercept reflect? How about the regression coefficient associated with the binary categorical variable? What if you were to remove the grand intercept? Now add other variables one at a time, along with interactions, and make sure you fully understand what each and every coefficient means. When you reach the three-way interaction model with which you are dealing, it will become clear to you how these are the same model that are simply parameterized differently.
That's all I can say right now. Off to bed.
 
Hope this helps.
 
Ryan
--
 
*Traditional Parameterization.
MIXED y BY Gender Time with BrainChange
/FIXED=Gender Time BrainChange Gender*Time Gender*BrainChange Time*BrainChange
Gender*Time*Brainchange | SSTYPE(3)
/PRINT SOLUTION
/METHOD=REML
/REPEATED=Time | SUBJECT(ID) COVTYPE(CS).
*Alternative Parameterization of the same model above.
MIXED y BY Gender Time with BrainChange
/FIXED=Gender Gender*Brainchange Gender*Time Gender*Time*Brainchange | NOINT SSTYPE(3)
/PRINT SOLUTION
/METHOD=REML
/REPEATED=time | SUBJECT(ID) COVTYPE(CS).

 
On Sun, Mar 24, 2013 at 10:55 PM, nanditav <[hidden email]> wrote:
Hi Ryan,

I have a quick follow-up question. I notice that your traditional model does
include intercepts for the fixed effects, but your alternate models do not.
I'm wondering why this is the case? Do I have to exclude intercepts in all
situation when between-group comparisons are made?

Nandi



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Understanding-three-way-interactions-in-MIXED-tp5718921p5719056.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: Understanding three-way interactions in MIXED

nanditav
Right, that's already making more sense. Thanks so much for all your help Ryan! It's much appreciated.

Nandi