Does randomisation test for the difference in means mu1, mu2
of two vectors `v1`

and `v2`

. Can do one or two sided tests.

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

`v1` |
Data vector for variable 1 |

`v2` |
Data vector for variable 2 |

`alternative` |
A character string specifying the alternative
hypothesis, must be one of |

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

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).

The p-value is returned as `$p.value`

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

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

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")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.