This functions get the compact letter display for
objects of class "glht". Modification was done to get the
letters to design with missing cells, non completelly crossed
factorial designs and nested factorial designs. These models are
usually declared by a model matrix to have all effects
estimated. It is assumed that Tukey contrasts was used.
cld2(object, level = 0.05)
| object | an object returned by |
|---|---|
| level | the nominal significance level. |
an object of class "cld" with letters to resume mean
comparisons.
# Toy data 1: experiment with cultivars in several locations. td1 <- expand.grid(loc = gl(5, 1), block = gl(3, 1), cult = LETTERS[1:6]) td1 <- subset(td1, !(loc == 1 & cult == "A")) td1 <- subset(td1, !(loc == 2 & cult == "B")) xtabs(~loc + cult, td1)#> cult #> loc A B C D E F #> 1 0 3 3 3 3 3 #> 2 3 0 3 3 3 3 #> 3 3 3 3 3 3 3 #> 4 3 3 3 3 3 3 #> 5 3 3 3 3 3 3#>#>logLik(m0)#> 'log Lik.' -86.46157 (df=30)# The same model but without rank deficience. td1$loccult <- with(td1, interaction(loc, cult, drop = TRUE)) m1 <- lmer(y ~ loccult + (1 | loc:block), data = td1) logLik(m1)#> 'log Lik.' -86.46157 (df=30)library(doBy) X <- LE_matrix(lm(nobars(formula(m1)), data = td1), effect = "loccult") rownames(X) <- levels(td1$loccult) dim(X)#> [1] 28 28Xs <- X[grepl(x = rownames(X), "^1\\."),] Xc <- apc(Xs) library(multcomp) g <- summary(glht(m1, linfct = Xc), test = adjusted(type = "fdr")) cld2(g)#> 1.B 1.C 1.D 1.E 1.F #> "e" "d" "c" "b" "a"#> #> Simultaneous Confidence Intervals #> #> Fit: lmer(formula = y ~ loccult + (1 | loc:block), data = td1) #> #> Quantile = 1.96 #> 95% confidence level #> #> #> Linear Hypotheses: #> Estimate lwr upr #> 1.B == 0 17.0000 11.6346 22.3654 #> 1.C == 0 30.0000 24.6346 35.3654 #> 1.D == 0 45.0000 39.6346 50.3654 #> 1.E == 0 60.0000 54.6346 65.3654 #> 1.F == 0 75.0000 69.6346 80.3654 #>