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, ...)

Arguments

x

A TukeyHSD object return from stats::TukeyHSD().

...

Additional arguments. Not used. Needed to match generic signature only. Cautionary note: Misspelled arguments will be absorbed in ..., where they will be ignored. If the misspelled argument has a default value, the default value will be used. For example, if you pass conf.lvel = 0.9, all computation will proceed using conf.level = 0.95. Additionally, if you pass newdata = my_tibble to an augment() method that does not accept a newdata argument, it will use the default value for the data argument.

Value

A tibble::tibble with one row per comparison and columns:

term

Term for which levels are being compared

comparison

Levels being compared, separated by -

estimate

Estimate of difference

conf.low

Low end of confidence interval of difference

conf.high

High end of confidence interval of difference

adj.p.value

P-value adjusted for multiple comparisons

See also

Examples

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