permutation_test_builder {twosamples}R Documentation

Permutation Test Builder

Description

This function takes a simple two-sample test statistic and produces a function which performs permutation tests using that test stat.

Usage

permutation_test_builder(test_stat_function, default.p = 2)

Arguments

test_stat_function

a function of two vectors producing a positive number, intended as the test-statistic to be used.

default.p

This allows for some introduction of defaults and parameters. Typically used to control the power functions raise something to.

Details

test_stat_function must be structured to take two separate vectors, and then a third value. i.e. (fun = function(vec1,vec2,val1) ...). See examples.

Value

This function returns a function which will perform permutation tests on given test stat.

Functions

Examples

mean_stat = function(a,b,p) abs(mean(a)-mean(b))**p
myfun = permutation_test_builder(mean_stat,2.0)
vec1 = rnorm(20)
vec2 = rnorm(20,4)
myfun(vec1,vec2)

[Package twosamples version 1.0.0 Index]