Description Usage Arguments Value Examples
This function creates a random sample of -1L and 1L values which can be used in randomization runs of one-sample and paired samples t-tests. Care is taken so that all samples are unique.
1 | osTtestRandomSigns(obj, nperm, seed)
|
obj |
a list object returned by |
nperm |
integer indicating the number of permutations |
seed |
an integer value which specifies a seed (default: NULL), or a
list of arguments passed to |
osTtestRandomSigns
returns an integer matrix (containing
only -1L and 1L values) with 'id_length' rows and 'nperm' columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
# this should fail: too many permutations for this sample size
obj <- list(.arraydat = matrix(8))
temp <- try(osTtestRandomSigns(obj, 1e4), silent = TRUE)
stopifnot(inherits(temp, "try-error"))
# expect an integer matrix containing unique series of -1L and 1L
obj <- list(.arraydat = matrix(10))
temp <- osTtestRandomSigns(obj, 500)
stopifnot(range(temp), c(-1L, 1L))
stopifnot(length(unique(as.vector(temp))) == 2L)
stopifnot(!anyDuplicated(temp, MARGIN = 2L))
obj <- list(.arraydat = matrix(20))
temp <- osTtestRandomSigns(obj, 1e4)
stopifnot(!anyDuplicated(temp, MARGIN = 2L))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.