Tool to do a two-sided permutation test on a dataset.

permutation(groups, observations, method = "mean", nPerm = 10^5)

Arguments

groups

The column of the datasat containing the two groups. Has to be factors.

observations

The column of the dataset containing the observations for the two groups. Has to be numeric.

method

One of 3 options: "mean" (Default), "median" or "my_method". If "my_method", the user has to define a function called "my_method(observations)" that calculates the test-statistic, with the only input being the observations from the data grouped by group.

nPerm

Number of permutations. Default is 10^5

Value

a list of class object "htest" and "permutation".

Details

Given a dataset where one column specifies the groups and another column specifies the observed values for each group, the function makes a two-sided permuation test. The method to calculate the test statistic used for the test can either be mean, median or a user defined method. Summary, plot or print can be called on the output of class "permutation" and "htest".

Examples