groupdiff {qacBase} | R Documentation |
One-way analysis (ANOVA or Kruskal-Wallis Test) with post-hoc comparisons and plots
groupdiff(
data,
y,
x,
method = c("anova", "kw"),
digits = 2,
horizontal = FALSE,
posthoc = FALSE
)
data |
a data frame. |
y |
a numeric response variable |
x |
a categorical explanatory variable. It will coerced to be a factor. |
method |
character. Either |
digits |
Number of significant digits to print. |
horizontal |
logical. If |
posthoc |
logical. If |
The groupdiff
function performs one of two analyses:
anova
A one-way analysis of variance, with TukeyHSD post-hoc comparisons.
kw
A Kruskal Wallis Rank Sum Test, with Conover Test post-hoc comparisons.
In each case, summary statistics and a grouped boxplots are
provided. In the parametric case, the statistics are n, mean, and
standard deviation. In the nonparametric case the statistics are
n, median, and median absolute deviation. If posthoc = TRUE
,
pairwise comparisons of superimposed on the boxplots.
Groups that share a letter are not significantly different (p < .05),
controlling for multiple comparisons.
a list with 3 components:
result
omnibus test
summarystats
summary statistics
plot
ggplot2 graph
kwAllPairsConoverTest, multcompLetters.
# parametric analysis
groupdiff(cars74, hp, gear)
# nonparametric analysis
groupdiff(cardata, popularity, vehicle_style, posthoc=TRUE,
method="kw", horizontal=TRUE)