[R-sig-ME] How do I interpret linear mixed model contrast estimates from multcomp::glht()?

Matthew Van Scoyoc scoyoc at gmail.com
Tue Dec 16 17:28:29 CET 2014


Sorry, I meant no disrespect. I just thought that by posting the question
on a more appropriate list, someone who has come across the same problem
would answer. The problem is actually with contrast::contrast(). The
function does not produce row names that correspond to the fixed effects or
the interactions in the model. So how do I figure out which row corresponds
to what, and  how do I pull that out of the contrast() object *cc?*

MVS
=====
Matthew Van Scoyoc

<mvanscoyoc at aggiemail.usu.edu>https://sites.google.com/site/scoyoc/
=====
Think SNOW!

On Tue, Dec 16, 2014 at 1:28 AM, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be
> wrote:
>
> Matthew,
>
> Just reposting exactly the same question on a other list is not very
> polite. I answered it on r-sig-ecology
> http://r-sig-ecology.471788.n2.nabble.com/How-do-I-interpret-linear-mixed-model-contrast-estimates-from-multcomp-glht-td7579236.html#a7579237
> If the answer is not clear enough, then let us know what you don't
> understand about it. Have you look at the examples in ?glht
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
> + 32 2 525 02 51
> + 32 54 43 61 85
> Thierry.Onkelinx at inbo.be
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> -----Oorspronkelijk bericht-----
> Van: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org]
> Namens Matthew Van Scoyoc
> Verzonden: vrijdag 12 december 2014 18:23
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] How do I interpret linear mixed model contrast
> estimates from multcomp::glht()?
>
> How do the rows in the summary (e.g. "1 == 0") correspond to the model?
> The answer is buried *contrast::contrast()*, but I can't figure it out.
> Consider this modified example I stole from here <
> https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q4/003061.html>...
>
> > options(contrasts = c(factor = "contr.SAS", ordered = "contr.poly"))
> > library("mlmRev")
> > library("lme4")
> > library("lmerTest")
> > library("contrast")
> > library("multcomp")
> >
> > data("egsingle")
> > # Linear mixed model
> > math.lmm <- lmer(math ~ year * size + female + (1|childid) +
> (1|schoolid), egsingle)
> > # Linear model
> > math.lm <- lm(math ~ year * size + female, data = egsingle) #
> > Calculate contrast matrix cc<-contrast(math.lm, a = list(year = c(0.5,
> > 1.5, 2.5), size = 380,
> female = levels(egsingle$female)), +
>                                                 b = list(year = c(0.5,
> 1.5, 2.5), size = 800, female = levels(egsingle$female)))
> > # Calculate estimates
> > summary(glht(math.lmm, linfct = cc$X))
>
>  Simultaneous Tests for General Linear Hypotheses
>
> Fit: lme4::lmer(formula = math ~ year * size + female + (1 | childid) +
>     (1 | schoolid), data = egsingle)
>
> Linear Hypotheses:
>               Estimate   Std. Error   z value   Pr(>|z|)
> 1 == 0  0.12774    0.08020     1.593     0.1272
> 2 == 0  0.15322    0.08066     1.900    0.0669 .
> 3 == 0  0.17870    0.08178     2.185    0.0341 *
> 4 == 0  0.12774    0.08020     1.593    0.1273
> 5 == 0  0.15322    0.08066     1.900    0.0669 .
> 6 == 0  0.17870    0.08178     2.185    0.0342 *
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Adjusted p
> values reported -- single-step method)
>
> The row names correspond to the levels of *year* and *female,* and are
> probably Female:0.5, Female:1.5, Female:2.5, and so on. But how do I pull
> that out of the contrast() object *cc?* It might be simple with 3 main
> effects, but my current project has 5 main effects, four 2-way
> interactions, and one 3-way interaction, and the summary table has 24 rows.
> Ultimately I would like to create a dataframe so I can plot the contrasts,
> something like this...
>
> > x = summary(glht(math.lmm, linfct = cc$X)) # Contrast data frame
> > math.contr = data.frame(Effect.Interaction =
> > reference.something.in.cc,
>                                                     Estimate =
> x[["test"]]$coefficients, Std.Error = x[["test"]]$sigma)
>
> Thanks for the help!
> Cheers,
> MVS
> =====
> Matthew Van Scoyoc
>
> <
> https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=mvanscoyoc@aggiemail.usu.edu
> >
> https://sites.google.com/site/scoyoc/
> =====
> Think SNOW!
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> Disclaimer Bezoek onze website / Visit our website<
> https://drupal.inbo.be/nl/disclaimer-mailberichten-van-het-inbo>
>

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list