How do I interpret linear mixed model contrast estimates from multcomp::glht()?
Dear Matthew, The part before "== 0" are the rownames of the matrix passed to linfct. When the rownames are missing, the rownumbers are used. Best regards, 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-ecology [mailto:r-sig-ecology-bounces at r-project.org] Namens Matthew Van Scoyoc Verzonden: vrijdag 12 december 2014 0:08 Aan: r-sig-ecology at r-project.org Onderwerp: [R-sig-eco] How do I interpret linear mixed model contrast estimates from multcomp::glht()? So, what do the rows correspond to in the summary (e.g. "1 == 0")? I was thinking the answer was buried *cc*, 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(.5, 1.5, 2.5), size = 380, female
= levels(egsingle$female)), +
b = list(year = c(.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)
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 = ..., 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 at aggiemail.usu.edu> https://sites.google.com/site/scoyoc/ ===== Think SNOW! _______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology Disclaimer Bezoek onze website / Visit our website<https://drupal.inbo.be/nl/disclaimer-mailberichten-van-het-inbo>