Does randomisation test for the difference in means of two vectors v1 and v2.

Share:

Description

Does randomisation test for the difference in means mu1, mu2 of two vectors v1 and v2. Can do one or two sided tests.

Usage

1
permute.groups(v1, v2, alternative, nreps)

Arguments

v1

Data vector for variable 1

v2

Data vector for variable 2

alternative

A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" (mu1>mu2) or "less". You can specify just the initial letter.

nreps

Number of replications used in the randomisation and generation of the p-value. Default is nreps=999

Details

Under the null hypothesis that mu1=mu2, the labelling of the n1+n2 observations is unimportant. Therefore, we can generate the null distribution for the test statistic m1-m2 or |m1-m2| depending on whether a one or two sided test is required) by randomly permuting the treatment labels nreps times and calculating the test statistic each time. The p-value is calculated as suggested by Manly (2006).

Value

The p-value is returned as $p.value

Author(s)

Jon Barry: Jon.Barry@cefas.co.uk

References

Manly BFJ (2006) Randomization, Bootstrap And Monte Carlo Methods in Biology: 3rd edition. Chapman and Hall.

See Also

power.groups, permute.BACI

Examples

1
2
3
4
set.seed(5)
v1 = rnorm(27,10,2); v2=rnorm(25,11,2)
permute.groups(v1, v2, alternative="two")
permute.groups(v1, v2, alt="l")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.