permutation: Permutation

Description Usage Arguments Details Value Examples

View source: R/permutation.R

Description

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

Usage

1
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

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

Value

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

Examples

1
2
3
4
5
6
7
The test data provided in the package, BloodPressure, can be used as follows:

permutation(groups = BloodPressure$Groups, observations = BloodPressure$Blood_pressure, method = "median", nPerm = 10^4)

summary(permutation)

plot(permutation)

aumath-advancedr2019/Sampling documentation built on Nov. 26, 2019, 2:08 a.m.