permTest {CarletonStats} | R Documentation |
Permutation test to test a hypothesis involving two samples.
permTest(x, ...) ## Default S3 method: permTest(x, group, statistic = mean, B = 9999, alternative = "two.sided", plot.hist = TRUE, legend.loc = "topright", plot.qq = FALSE, ...) ## S3 method for class 'formula' permTest(formula, data = parent.frame(), subset, ...)
x |
a numeric vector. If the function is the mean ( |
... |
further arguments to be passed to or from methods. |
group |
a factor variable with two levels. If |
statistic |
the statistic of interest. |
B |
the number of resamples (positive integer greater than 2). |
alternative |
the alternative hypothesis. Options are
|
plot.hist |
a logical value. If |
legend.loc |
location of the legend for the histogram. Options are
|
plot.qq |
a logical value. If |
formula |
a formula of the form |
data |
a data frame with the variables in the formula. |
subset |
an optional expression specifying which observations to keep. |
Permutation test to see if a population parameter is the same for two populations. For instance, test H_0: μ_M = μ_F where μ denotes the population mean. The values of the numeric variable are randomly assigned to the two groups and the difference of the statistic for each group is calculated. The command will print the mean and standard error of the distribution of the test statistic as well as a P-value.
Observations with missing values are removed.
Returns invisibly a vector of the replicates of the test statistic.
default
: Permutation test
formula
: Permutation test
Laura Chihara
Tim Hesteberg's website: http://www.timhesterberg.net/bootstrap
permTest(states03$ViolentCrime, states03$DeathPenalty) #using formula syntax permTest(ViolentCrime ~ DeathPenalty, data = states03, alt = "less")