0

I am comparing two models in order to see if a specific interaction (SessionGroup) is significant. Mod1 is the full model, Mod2 is the full model MINUS the SessionGroup interaction.

mod1 = lmer(accuracy ~ session + trialtype + group + session*trialtype +     
session*group + session*group*trialtype + trialtype*group + 
(1+trialtype|subject), data=data, REML=FALSE)

mod2 = lmer(accuracy ~ session + trialtype + group + session*trialtype + 
session*group*trialtype + trialtype*group + (1+trialtype|subject), 
data=data, REML=FALSE)

Here is my identical output:

Data: data
Models:
mod1: accuracy ~ session + trialtype + group + session * trialtype + 
mod1:     session * group + session * group * trialtype + trialtype * 
mod1:     group + (1 + trialtype | subject)
mod2: accuracy ~ session + trialtype + group + session * trialtype + 
mod2:     session * group * trialtype + trialtype * group + (1 + trialtype 
| 
mod2:     subject)
     Df    AIC    BIC  logLik deviance Chisq Chi Df Pr(>Chisq)
mod1 27 4026.4 4150.3 -1986.2   3972.4                        
mod2 27 4026.4 4150.3 -1986.2   3972.4     0      0          1

Something is wrong with the code, I just can't figure it out. Also, is this the correct way to compare 2 models when looking at main effects/interactions? I've never taken an MLM class, so I've been teaching myself as I do this.

Thank you in advance!

Also: here is a subset of my data, as suggested, if it helps:

subject  accuracy group session trialtype
1        5 1.0000000     1       2        BX
2       93 0.8000000     2       2        BX
3       12 0.8000000     2       2        BY
4       85 1.0000000     3       1        BX
5       21 1.0000000     3       2        AX
6       54 0.9900000     2       2        AX
7        2 0.8000000     1       1        BY
8       36 0.9142857     2       1        BX
9        1 1.0000000     1       2        AY
10       4 0.7900000     1       2        BY
CogNeuro123
  • 33
  • 1
  • 6
  • 1
    You may be looking for `:` to indicate interactions. Using `*` for interactions is a short-cut to fit all main effects and interactions of the variables involved. For example, `session*group` expands to `session + group + session:group`. Since you have `session*group*trialtype` in your second model that model still contains the `session:group` interaction in it (which maybe you were trying to test?). Regardless, I don't *think* you will be able to do a LRT for a lower order interaction via `anova()` if a higher order interaction is in the model. – aosmith Jun 26 '19 at 21:12
  • Thank you @aosmith ! I edited my code to use : instead of *, but I get the same result. I also tried a simple model using the fixed effects session + group + session:group and compared it with a model that just had session+group and got the same results. – CogNeuro123 Jun 26 '19 at 21:19
  • That last one you said you tried *should* work, although session and group should likely be perfectly crossed. To get more help from folks you'll need to provide a reproducible example of your dataset. See [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for ideas on how to do this. – aosmith Jun 26 '19 at 21:22
  • I tried this also mod1 = lmer(accuracy ~ session*group*trialtype + (1+trialtype|subject), data=data, REML=FALSE) mod2 = lmer(accuracy ~ session:group + (1+trialtype|subject), data=data, REML=FALSE) I get mod 1 p=.91, but what I'm struggling with is the fact that this specific interaction is significant (p=.02) when I run these analyses in SPSS. – CogNeuro123 Jun 26 '19 at 21:23
  • Thank you, @aosmith, I just added some data. – CogNeuro123 Jun 26 '19 at 21:36
  • I can't reproduce any problems with your small example dataset. Maybe try package **car** `Anova()` for Type II or Type III tests, instead? (If your data aren't perfectly balanced you may need to change the contrasts in your model.) Also see the **lmerTest** package, which could be useful to you. – aosmith Jun 26 '19 at 21:55

0 Answers0