permTestPaired {CarletonStats} | R Documentation |
Permutation test for paired data.
permTestPaired(x, ...) ## Default S3 method: permTestPaired(x, y, B = 9999, alternative = "two.sided", plot.hist = TRUE, legend.loc = "topright", plot.qq = FALSE, x.name = deparse(substitute(x)), y.name = deparse(substitute(y)), ...) ## S3 method for class 'formula' permTestPaired(formula, data, subset, ...)
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 |
legend.loc |
a logical value. If |
plot.qq |
a logical value. If |
x.name |
Label for x variable |
y.name |
Label for y variable |
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. |
For two paired numeric variables with n rows, randomly select k of the n
rows (k also is randm) and switch the entries (a, b) \to (b, a)
and then compute the mean of the difference of the two variables (y-x
).
Observations with missing values are removed.
Returns invisibly a vector of the replicates of the test statistic (ex. mean of the difference of the resampled variables).
default
: Permutation test for paired data.
formula
: Permutation test for paired data.
Laura Chihara
Tim Hesterberg's website: http://www.timhesterberg.net/bootstrap
#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")