r - How does plot.cld in multcomp package calculate boxes? -
to visualise significant differences letters there plotting function in multcomp package:
library(multcomp) tuk <- glht(model, linfct = mcp(effect = "tukey")) plot(cld(tuk))
how boxes calculated (i.e. upper , lower quartiles , whiskers)? not find information in documentation.
this regular boxplot
. instance warpbreaks
data:
# load data data(warpbreaks) # model amod <- aov(breaks ~ tension, data = warpbreaks) tuk <- glht(amod, linfct = mcp(tension = "tukey")) # plot plot(cld(tuk))
this pretty same
boxplot(breaks ~ tension, data = warpbreaks) # or boxplot(split(warpbreaks$breaks, warpbreaks$tension))
boxplot
uses boxplot.stats
, uses stats.fivenum
calculate necessary statistics. notice differs quantile
function probs=c(0,.25, .5, .75, 1)
, na.rm=true
. in simplest form (no na
's, length>0), fivenum
looks this:
fivenum <- function (x) { x <- sort(x) n <- length(x) n4 <- floor((n + 3)/2)/2 d <- c(1, n4, (n + 1)/2, n + 1 - n4, n) 0.5 * (x[floor(d)] + x[ceiling(d)]) }
Comments
Post a Comment