htest | R Documentation |
Basic Bivariate Hypothesis Testing and Plotting
htest(
y,
group = NULL,
x = NULL,
yname = NULL,
groupname = NULL,
xname = NULL,
test = c("t.test", "wilcox.test", "aov", "kruskal.test", "chisq.test", "fisher.test",
"cor.test", "pearson", "kendall", "spearman", "ks"),
print.plot = TRUE,
plot.args = list(),
theme = rtTheme,
verbose = TRUE,
...
)
y |
Float, vector: Outcome of interest |
group |
Factor: Groups to compare |
x |
Float, vector: Second outcome for correlation tests |
yname |
Character: y variable name |
groupname |
Character: group variable name |
xname |
Character: x variable name |
test |
Character: Test to use; one of:
|
print.plot |
Logical: If TRUE, print plot. Default = TRUE |
plot.args |
List of arguments to pass to plotting function |
theme |
Character: Run |
verbose |
Logical: If TRUE, print messages to console. Default = TRUE |
... |
Additional arguments to pass to test call |
E.D. Gennatas
## Not run:
# t.test, wilcoxon
y <- c(rnorm(200, 2, 1.2), rnorm(300, 2.5, 1.4))
group <- c(rep(1, 200), rep(2, 300))
ht_ttest <- htest(y, group, test = "t.test")
ht_wilcoxon <- htest(y, group, test = "wilcox.test")
# aov, kruskal
y <- c(rnorm(200, 2, 1.2), rnorm(300, 2.5, 1.4), rnorm(100, 2.3, 1.1))
group <- c(rep(1, 200), rep(2, 300), rep(3, 100))
ht_aov <- htest(y, group, test = "aov")
ht_kruskal <- htest(y, group, test = "kruskal.test")
# chisq, fisher
y <- c(sample(c(1, 2), 100, T, c(.7, .3)), sample(c(1, 2), 100, T, c(.35, .65)))
group <- c(rep(1, 100), rep(2, 100))
ht_chisq <- htest(y, group, test = "chisq")
ht_fisher <- htest(y, group, test = "fisher")
# cor.test
x <- rnorm(300)
y <- x * .3 + rnorm(300)
ht_pearson <- htest(x = x, y = y, test = "pearson")
ht_kendall <- htest(x = x, y = y, test = "kendall")
ht_kendall <- htest(x = x, y = y, test = "spearman")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.