isTtestRandomGroups: Create random group memberships for independent samples...

Description Usage Arguments Value Examples

View source: R/ttest.R

Description

This function creates a random permutation of the original group memberships for independent samples t-tests. Care is taken so that all permutations are unique.

Usage

1
isTtestRandomGroups(obj, nperm, seed = NULL)

Arguments

obj

a list object returned by preTtest; the obj$groups element is relevant indicating the original group memberships

nperm

integer indicating the number of permutations

seed

an integer value which specifies a seed (default: NULL), or a list of arguments passed to set.seed

Value

isTtestRandomGroups returns a matrix with as many rows as the length of 'group' and as many columns as 'nperm'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# this should fail: too many permutations on a small sample
temp <- try(isTtestRandomGroups(list(groups = rep(1:2, each = 4L), 1e3)), 
            silent = TRUE)
stopifnot(inherits(temp, "try-error"))

# all permutations should be unique
temp <- isTtestRandomGroups(list(groups = rep(1:2, c(6, 4))), 500)
stopifnot(!anyDuplicated(temp, MARGIN = 2L))
temp <- isTtestRandomGroups(list(groups = rep(1:2, each = 20L)), 1e4)
stopifnot(!anyDuplicated(temp, MARGIN = 2L))

## End(Not run)

tdeenes/eegR documentation built on April 19, 2021, 4:17 p.m.