Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies cross models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.
# S3 method for TukeyHSD tidy(x, ...)
x | A |
---|---|
... | Additional arguments. Not used. Needed to match generic
signature only. Cautionary note: Misspelled arguments will be
absorbed in |
A tibble::tibble with one row per comparison and columns:
Term for which levels are being compared
Levels being compared, separated by -
Estimate of difference
Low end of confidence interval of difference
High end of confidence interval of difference
P-value adjusted for multiple comparisons
Other anova tidiers: tidy.anova
,
tidy.aovlist
, tidy.aov
,
tidy.manova
fm1 <- aov(breaks ~ wool + tension, data = warpbreaks) thsd <- TukeyHSD(fm1, "tension", ordered = TRUE) tidy(thsd)#> # A tibble: 3 x 6 #> term comparison estimate conf.low conf.high adj.p.value #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 tension M-H 4.72 -4.63 14.1 0.447 #> 2 tension L-H 14.7 5.37 24.1 0.00112 #> 3 tension L-M 10. 0.647 19.4 0.0336# may include comparisons on multiple terms fm2 <- aov(mpg ~ as.factor(gear) * as.factor(cyl), data = mtcars) tidy(TukeyHSD(fm2))#> # A tibble: 42 x 6 #> term comparison estimate conf.low conf.high adj.p.value #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 as.factor(gear) 4-3 8.43 5.19 11.7 0.00000297 #> 2 as.factor(gear) 5-3 5.27 0.955 9.59 0.0147 #> 3 as.factor(gear) 5-4 -3.15 -7.60 1.30 0.201 #> 4 as.factor(cyl) 6-4 -5.40 -9.45 -1.36 0.00748 #> 5 as.factor(cyl) 8-4 -5.23 -8.60 -1.86 0.00201 #> 6 as.factor(cyl) 8-6 0.172 -3.70 4.04 0.993 #> 7 as.factor(gear):as.factor… 4:4-3:4 5.42 -6.65 17.5 0.832 #> 8 as.factor(gear):as.factor… 5:4-3:4 6.70 -7.24 20.6 0.778 #> 9 as.factor(gear):as.factor… 3:6-3:4 -1.75 -15.7 12.2 1.00 #> 10 as.factor(gear):as.factor… 4:6-3:4 -1.75 -14.5 11.0 1.00 #> # … with 32 more rows