3

I have done an experiment where subjects where asked to recognized different emotions presented to them in two different situations: while in motion and at rest.

To analyze the model I have constructed a mixed model with lmer:

mod <- lmer(percentage ~ situation + emotion + 
            (1|subject), data = df)

where percentage is the percentage of correctly recognized emotions. I have verified this model is indeed linear by verifying the usual assumptions (linearity, homoskedasticity, normality, cook's distances) and it seems fine.

Now, I'd like to compare the levels between each other, for instance to determine if there is significant difference of emotion recognition at rest or in movement or between the emotions.

What I have done so fare is to use glht in the following way:

summary(glht(mod, mcp(situation="Tukey")))
     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: lmer(formula = percentage ~ situation + 
 emotion + (1 | subject), 
    data = df)

Linear Hypotheses:
                     Estimate Std. Error z value Pr(&gt;|z|)    
static - motion == 0  -13.765      2.297  -5.992 2.08e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)

and

&gt; summary(glht(mod,mcp(emotion=&quot;Tukey&quot;)))

     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: lmer(formula = percentage ~ situation + emotion + (1 | subject), 
    data = df)

Linear Hypotheses:
                          Estimate Std. Error z value Pr(&gt;|z|)    
disgust - anger == 0         7.812      3.979   1.963  0.36360    
fear - anger == 0          -27.232      3.979  -6.844  &lt; 0.001 ***
happiness - anger == 0      43.750      3.979  10.995  &lt; 0.001 ***
sadness - anger == 0        -7.366      3.979  -1.851  0.43272    
surprise - anger == 0       14.955      3.979   3.758  0.00236 ** 
fear - disgust == 0        -35.045      3.979  -8.807  &lt; 0.001 ***
happiness - disgust == 0    35.938      3.979   9.031  &lt; 0.001 ***
sadness - disgust == 0     -15.179      3.979  -3.814  0.00190 ** 
surprise - disgust == 0      7.143      3.979   1.795  0.46888    
happiness - fear == 0       70.982      3.979  17.838  &lt; 0.001 ***
sadness - fear == 0         19.866      3.979   4.992  &lt; 0.001 ***
surprise - fear == 0        42.188      3.979  10.602  &lt; 0.001 ***
sadness - happiness == 0   -51.116      3.979 -12.846  &lt; 0.001 ***
surprise - happiness == 0  -28.795      3.979  -7.236  &lt; 0.001 ***
surprise - sadness == 0     22.321      3.979   5.610  &lt; 0.001 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)

However, is this a correct approach? Or is there a better way to analyze the data?

anfneub
  • 31
  • This depends on your research question of interest: Do you suspect an interaction? If so, you need to model that. Also, I would add random slopes, because I suspect that it is very likely the manipulations have different effects on different people: (1 + situation + emotion |subject). You can perform hypothesis tests to see if there really is variation in the effects of your IVs between people: https://stats.stackexchange.com/a/276555/130869 – Mark White Jun 16 '17 at 21:27
  • Thank you for your comment. The primary focus of this research is indeed to compare the differences in the levels, if any. But since we're talking about the model, an ANOVA analysis seems to suggest that the model percentage ~ situation * emotion + (1+ situation + emotion|subject) with interaction and your random effect seems the better one in terms of AIC and p-value.

    However, if I now try to apply my glht approach like before, I get the warning In mcp2matrix: covariate interactions found -- default contrast might be inappropriate

    – anfneub Jun 16 '17 at 23:14
  • I will have to read into this more, but I believe it is because glht does not know that your interaction terms are interaction terms? Have you tried specifying your own contrasts? – Mark White Jun 16 '17 at 23:18
  • No, and I wouldn't know how to do that either – anfneub Jun 16 '17 at 23:24
  • Would you be able to post the data? If the dataset is not too big, try dput(df). It will return code that you can copy and paste into the question that anyone can copy and paste and recreate your dataset. – Mark White Jun 16 '17 at 23:31
  • I put a restricted dataset containing the useful variables here (https://pastebin.com/s7ZR08EY). Hope you can import the data easily. Also so far I've been testing the models with the commands mod0 <- lmer(percentage ~ situation + emotion + (1 |subject), data = df, REML = FALSE) mod1 <- lmer(percentage ~ situation + emotion + (1 + situation + emotion|subject), data = df, REML = FALSE) mod2 <- lmer(percentage ~ situation * emotion + (1 + situation + emotion|subject), data = df, REML = FALSE, control = lmerControl(optCtrl = list(maxfun=100000))) anova(mod0,mod1,mod2) – anfneub Jun 16 '17 at 23:39
  • Actually here (https://pastebin.com/CxV8xm5P), didn't see the dput(df) output first, sorry. – anfneub Jun 16 '17 at 23:51
  • I'll take a look this weekend – Mark White Jun 17 '17 at 00:17

1 Answers1

1

Before you do the modelling, it will help if you have a look at some graphical summary of your data. For example,

library(ggplot2)
ggplot(df, aes(emotion, percentage, col=situation)) + geom_point() 

Subjects seem to be good in general at detecting happiness but not fear regardless of the situation.

ggplot(df, aes(emotion, percentage, col=situation)) + geom_point() + facet_grid(subject ~ .)

From your uploaded data, I cannot fit interaction effect between emotion and situation as the interaction completely indexes the data. From looking at this partial data, it's hard to fit a more complex model and so your initial model seems fine (although I would think situation is not significant for your partial data and can be dropped). This does not answer certain questions you may want though. For example, you cannot answer how different situations affect the ability to recognise certain emotions. My suggestion is to have a look at some graphical plot first.

aimi
  • 11