Games-Howell, Tukey HSD and other post-hoc tests for ANOVA and Welch ANOVA. Either Games-Howell test or Tukey honestly significant difference (HSD) post-hoc tests for one-way analysis of variance (ANOVA).

posthoc_anova(
  y,
  group = NULL,
  method = c("Games-Howell", "Tukey"),
  conf_level = 0.95,
  digits = 3,
  digits_p = 3,
  p_adjust = "none",
  format_pvalue = TRUE,
  data = NULL,
  ...
)

# S3 method for formula
posthoc_anova(
  y,
  group = NULL,
  method = c("Games-Howell", "Tukey"),
  conf_level = 0.95,
  digits = 3,
  digits_p = 3,
  p_adjust = "none",
  format_pvalue = TRUE,
  data = NULL,
  ...,
  sep = " | "
)

# S3 method for default
posthoc_anova(
  y,
  group = NULL,
  method = c("Games-Howell", "Tukey"),
  conf_level = 0.95,
  digits = 3,
  digits_p = 3,
  p_adjust = "none",
  format_pvalue = TRUE,
  data = NULL,
  ...
)

# S3 method for posthoc_anova
print(
  x,
  digits = x$input$digits,
  digits_p = x$input$digits_p,
  digits_param = 2,
  ...
)

# S3 method for posthoc_anova
plot(
  x,
  ...,
  zero_line_color = "grey",
  add_p = TRUE,
  p_size = 1,
  p_color = "blue",
  p_pos_adj = 0.22,
  flip_xy = TRUE
)

Arguments

y

(numeric|formula)
Either a numeric vector or formula.

group

(factor)
a vector that either is a factor or can be converted into one. If y is a formula, group is ignored.

method

("games-howell"|"tukey")
Name of post-hoc tests to conduct. Valid values are "tukey" and "games-howell".

conf_level

(number)
Confidence level (equals to 1 - alpha, where alpha is significanve level). Number from 0 to 1. Default is 0.95.

digits

(integer)
The number of digits to round data related numbers to.

digits_p

(integer)
The number of digits to round p values to. Must be 2, 3 or more.

p_adjust

Any valid stats::p.adjust() method.

format_pvalue

(does not work yet)
Whether to format the p values according to APA standards (i.e. replace all values lower than .001 with '<.001'). This only applies to the printing of the object, not to the way the p values are stored in the object.

data

(data frame)
a data frame with data to be used in combination with formula.

...

Further arguments to methods.

sep

(character)
A string with a symbol to separate group names if several grouping variables are used.

x

object to print.

zero_line_color

(character) Color for line indicating zero differences.

add_p

(logical) Flag if p values should be added.

p_size

(numeric) Font size to p-values-related text.

p_color

(character) Color for p values.

p_pos_adj

(numeric) Factor for p value position correction

flip_xy

(logical) Flag if x and y axes should be swapped.

Value

A list of three elements:

input

List with input arguments

output

List with post-hoc test results

.

Details

The main part of the function code and descriptions were imported from posthocTGH() in package userfriendlyscience.

Note

Options that carry out Games-Howell and Tukey HSD analyses are based on code of function posthocTGH() in package userfriendlyscience (version 0.7.0).

See also

Examples

library(biostat) # Compute post-hoc statistics using the Games-Howell method posthoc_anova(weight ~ Diet, data = ChickWeight, method = "Games-Howell")
#> Games-Howell test results (ANOVA post-hoc) #> #> groups difference ci_lower ci_upper t df p #> 1 2-1 19.971 0.358 39.585 2.64 201.38 0.044 * #> 2 3-1 40.305 17.544 63.065 4.59 175.92 <0.001 *** #> 3 4-1 32.617 13.452 51.783 4.41 203.16 <0.001 *** #> 4 3-2 20.333 -6.203 46.870 1.98 229.94 0.197 #> 5 4-2 12.646 -10.909 36.201 1.39 235.88 0.507 #> 6 4-3 -7.687 -33.899 18.524 0.76 226.16 0.873 #> #> group n mean variance sd cld spaced_cld #> 1 1 220 102.645 3209.965 56.657 a a_ #> 2 2 120 122.617 5127.633 71.607 b _b #> 3 3 120 142.950 7489.476 86.542 b _b #> 4 4 118 135.263 4737.392 68.829 b _b
# Compute post-hoc statistics using the Tukey method posthoc_anova(weight ~ Diet, data = ChickWeight, method = "Tukey")
#> Tukey HSD test results (ANOVA post-hoc) #> #> groups difference ci_lower ci_upper t df p #> 1 2-1 19.971 -0.300 40.242 2.54 574.00 0.055 . #> 2 3-1 40.305 20.034 60.576 5.12 574.00 <0.001 *** #> 3 4-1 32.617 12.235 52.999 4.12 574.00 <0.001 *** #> 4 3-2 20.333 -2.727 43.394 2.27 574.00 0.106 #> 5 4-2 12.646 -10.512 35.804 1.41 574.00 0.495 #> 6 4-3 -7.687 -30.845 15.470 0.86 574.00 0.828 #> #> group n mean variance sd cld spaced_cld #> 1 1 220 102.645 3209.965 56.657 a a_ #> 2 2 120 122.617 5127.633 71.607 ab ab #> 3 3 120 142.950 7489.476 86.542 b _b #> 4 4 118 135.263 4737.392 68.829 b _b