This function is used by the 'oneway' function for oneway analysis of variance in case a user requests post-hoc tests using the Tukey or Games-Howell methods.

posthocTGH(y, x, method=c("games-howell", "tukey"),
           conf.level = 0.95, digits=2, p.adjust="none",
           formatPvalue = TRUE)

Arguments

y

y has to be a numeric vector.

x

x has to be vector that either is a factor or can be converted into one.

method

Which post-hoc tests to conduct. Valid values are "tukey" and "games-howell".

conf.level

Confidence level of the confidence intervals.

digits

The number of digits to show in the output.

p.adjust

Any valid p.adjust method.

formatPvalue

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.

Value

A list of three elements:

input

List with input arguments

intermediate

List of intermediate objects.

output

List with two objects 'tukey' and 'games.howell', containing the outcomes for the respective post-hoc tests.

Note

This function is based on a file that was once hosted at http://www.psych.yorku.ca/cribbie/6130/games_howell.R, but has been removed since. It was then adjusted for implementation in the userfriendlyscience package. Jeffrey Baggett needed the confidence intervals, and so emailed them, after which his updated function was used. In the meantime, it appears Aaron Schlegel (https://rpubs.com/aaronsc32) independently developed a version with confidence intervals and posted it on RPubs at https://rpubs.com/aaronsc32/games-howell-test.

Also, for some reason, p.adjust can be used to specify additional correction of p values. I'm not sure why I implemented this, but I'm not entirely sure it was a mistake either. Therefore, in userfriendlyscience version 0.6-2, the default of this setting changed from "holm" to "none" (also see https://stats.stackexchange.com/questions/83941/games-howell-post-hoc-test-in-r).

Examples

### Compute post-hoc statistics using the tukey method posthocTGH(y=ChickWeight$weight, x=ChickWeight$Diet, method="tukey");
#> n means variances #> 1 220 103 3210 #> 2 120 123 5128 #> 3 120 143 7489 #> 4 118 135 4737 #> #> diff ci.lo ci.hi t df p #> 2-1 20.0 -0.3 40 2.54 574 .06 #> 3-1 40.3 20.0 61 5.12 574 <.01 #> 4-1 32.6 12.2 53 4.12 574 <.01 #> 3-2 20.3 -2.7 43 2.27 574 .11 #> 4-2 12.6 -10.5 36 1.41 574 .5 #> 4-3 -7.7 -30.8 15 0.86 574 .83
### Compute post-hoc statistics using the games-howell method posthocTGH(y=ChickWeight$weight, x=ChickWeight$Diet);
#> n means variances #> 1 220 103 3210 #> 2 120 123 5128 #> 3 120 143 7489 #> 4 118 135 4737 #> #> diff ci.lo ci.hi t df p #> 2-1 20.0 0.36 40 2.64 201 .04 #> 3-1 40.3 17.54 63 4.59 176 <.01 #> 4-1 32.6 13.45 52 4.41 203 <.01 #> 3-2 20.3 -6.20 47 1.98 230 .2 #> 4-2 12.6 -10.91 36 1.39 236 .51 #> 4-3 -7.7 -33.90 19 0.76 226 .87