Learn R Programming

asbio (version 0.2-1)

MC.test: Monte Carlo hypothesis testing for two samples.

Description

MC.test2 calculates a permutation of test statistics from an pooled variance t-test. It compares this distribution to an initial test statistic calculated using non-permuted data to derive a p-value.

Usage

MC.test(Y,X, perm = 1000, alternative = c("less", "greater", "not.equal"))

Arguments

Y
Response data.
X
Categorical explanatory variable.
perm
Number of iterations.
alternative
Alternative hypothesis. One of three options: "less","greater", or "not.equal". These provide lower-tail, upper-tail, and two-tailed tests.

Value

  • Returns a list with the following items:
  • observed.test.statistict-statistic calculated from non-permuted (original)data.
  • no_of_permutations_exceeding_observed_valueThe number of times a Monte Carlo derived test statistic was more extreme than the initial observed test statistic.
  • p.valueEmpirical p-value
  • alternativeThe alternative hypothesis

Details

The method follows the description of Manly (1998) for a two-sample test. The pooled variance t-test procedure assumes homoscedasticity for the populations being compared. Upper and lower tailed tests are performed by finding the portion of the distribution greater than or equal to the observed test statistic (upper-tailed) or less than or equal to the observed test statistic (lower-tailed). A two tailed test is performed by multiplying the portion of the null distribution above the absolute value of the observed test statistic by two. Results from the test will be similar to oneway_test from the library coin since it is based on an equivalent test statistic. The function oneway_test allows additional options including blocking.

References

Manly, B. F. J. (1997) Randomization and Monte Carlo methods in biology, 2nd edition. Chapman and Hall, London.

See Also

t.test

Examples

Run this code
Y<-c(runif(100,1,3),runif(100,1.2,3.2))
X<-factor(c(rep(1,100),rep(2,100)))
MC.test(Y,X,alternative="less")

Run the code above in your browser using DataLab