permTestPaired {CarletonStats} | R Documentation |
Permutation test for paired data.
Description
Permutation test for paired data.
Usage
permTestPaired(x, ...)
## Default S3 method:
permTestPaired(
x,
y,
B = 9999,
alternative = "two.sided",
plot.hist = TRUE,
plot.qq = FALSE,
x.name = deparse(substitute(x)),
y.name = deparse(substitute(y)),
xlab = NULL,
ylab = NULL,
title = NULL,
seed = NULL,
...
)
## S3 method for class 'formula'
permTestPaired(formula, data, subset, ...)
Arguments
x |
a numeric vector. |
... |
further arguments to be passed to or from methods. |
y |
a numeric vector. |
B |
the number of resamples. |
alternative |
the alternative hypothesis. Options are
|
plot.hist |
a logical value. If |
plot.qq |
a logical value. If |
x.name |
Label for x variable |
y.name |
Label for y variable |
xlab |
an optional character string for the x-axis label |
ylab |
an optional character string for the y-axis label |
title |
an optional character string giving the plot title |
seed |
optional argument to |
formula |
a formula of the form |
data |
an optional data frame containing the variables in the formula. By default the variables are taken from environment(formula). |
subset |
an optional vector specifying a subset of observations to be used. |
Details
For two paired numeric variables with n rows, randomly select k of the n
rows (k also is randm) and switch the entries
and then compute the mean of the difference of the two variables (
y-x
).
Observations with missing values are removed.
Value
Returns invisibly a vector of the replicates of the test statistic (ex. mean of the difference of the resampled variables).
Methods (by class)
-
permTestPaired(default)
: Permutation test for paired data. -
permTestPaired(formula)
: Permutation test for paired data.
Author(s)
Laura Chihara
References
Tim Hesterberg's website: https://www.timhesterberg.net/bootstrap-and-resampling
Examples
#Does chocolate ice cream have more calories than vanilla ice cream, on average?
#H0: mean number of calories is the same
#HA: mean number of calories is greater in chocolate ice cream
permTestPaired(Icecream$VanillaCalories, Icecream$ChocCalories, alternative = "less")
permTestPaired(ChocCalories ~ VanillaCalories, data = Icecream, alternative = "greater")