pval {CIPerm} | R Documentation |
Permutations-methods p-values for difference in means, medians, or Wilcoxon rank sum test
Description
Calculate p-values for a two-sample permutation or randomization test.
In other words, we set up a permutation or randomization test to evaluate
the null hypothesis that groups A and B have the same distribution,
then calculate p-values for several alternatives:
a difference in means (value="m"
),
a difference in medians (value="d"
),
or the Wilcoxon rank sum test (value="w"
).
Usage
pval(
dset,
tail = c("Two", "Left", "Right"),
value = c("m", "s", "d", "w", "a")
)
Arguments
dset |
The output of |
tail |
Which tail? Either "Two"- or "Left"- or "Right"-tailed test. |
value |
Either "m" for difference in means (default); "s" for sum of Group 1 values [equivalent to "m" and included only for sake of checking results against Nguyen (2009) and Ernst (2004)]; "d" for difference in medians; or "w" for Wilcoxon rank sum statistic; or "a" for a named vector of all four p-values. |
Value
Numeric p-value for the selected type of test,
or a named vector of all four p-values if value="a"
.
Examples
x <- c(19, 22, 25, 26)
y <- c(23, 33, 40)
demo <- dset(x, y)
pval(dset = demo, tail = "Left", value = "s")
pval(dset = demo, tail = "Left", value = "a")