MATLAB Answers

How do I apply a multiple comparison method to linear mixed effect model results?

25 views (last 30 days)
Paul Fishback
Paul Fishback on 16 Jun 2016
Commented: yuval on 6 Oct 2018
I have a data file (available for download at and based upon the research of Winder Grawunder, 2012) that gives conversation voice frequency (Hz) as a function of gender (M/F), attitude (formal/informal register), conversation scenario, e.g. asking a question vs. making a demand, etc., (broken into 7 scenario categories). The data was collected from six different individuals. For each individual, I can store the results in a table, T, having column headers attitude, gender, scenario, and frequency.
If I treat frequency as the numeric response, attitude and gender as fixed categorical effects, and scenario as a categorical random effect, a mixed linear mixed effect model corresponding to this data for each individual is given by
LME = fitlme(T,'frequency~attitude+gender+(1|scenario)');
The command anova(LME), gives me a p-value for each fixed effect, indicating its significance in determining the frequency. However, this p-value varies among the six individuals.
How do I combine all of the data across the six individuals to determine whether a fixed effect, such as gender, is significant in determining the pitch overall?
I realize that this is a multiple comparison problem. Can this be implemented using the multcompare command? If so, what steps are involved, starting from a single file that also accounts for the individuals? (It's stored in a table with column headers, gender, scenario, attitude, frequency, and individual.)

  1 Comment

yuval on 6 Oct 2018
Shouldn't it be analyzed as a hierarchical linear model? As in scenarios nested in individuals? I wouldn't fit a different model for each individual, rather than add individuals as another level to the model. If you fit a model per person, doesn't gender just represents the intercept?

Sign in to comment.

Answers (2)

dimitris on 24 Jan 2017
Run an ANOVA on the LME object (the output of fitlme) eq, anova(LME) It will give you a summary with the F statistics and the corresponding p-values for each fixed factor you included in your GLM.

  1 Comment

Paul on 31 Aug 2018
Running anova() on output from fitlme() does not produce acceptable output for multcompare().

Sign in to comment.

Sébastien Puma
Sébastien Puma on 20 Dec 2017
I have the exact same question using fitglme function. glme = fitglme (data + pred 1 + pred 2) will provide an output that you can use as input for an Anova : stats = anova (glme).
Yet, multcompare is the only multiple comparisons function I found and does not accept anova' stats as an input.
Since the other anova functions are not valid methods for lme or glme tables, how is it possible to compare groups while using linear mixed effects models ?


Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!