test_perm: Permutation test

Description Usage Arguments Value Examples

View source: R/test_perm.R

Description

Permutation test

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
test_perm(
  Y,
  X,
  Z = NULL,
  n_perm = 100,
  parallel = FALSE,
  n_cpus = NULL,
  space_y = FALSE,
  number_y = length(Y)
)

Arguments

Y

a numeric vector of size n containing the preprocessed expression for a given gene from n samples (or cells).

X

a data frame of numeric or factor vector(s) of size n containing the variable(s) to be tested (the condition(s)). Multiple variables are not allowed.

Z

a data frame of numeric or factor vector(s) of size n containing the covariate(s). Multiple variables are not allowed.

n_perm

the number of permutations. Default is 100.

parallel

a logical flag indicating whether parallel computation should be enabled. Default is TRUE.

n_cpus

an integer indicating the number of cores to be used when parallel is TRUE. Default is parallel::detectCores() - 1.

space_y

a logical flag indicating whether the y thresholds are spaced. When space_y is TRUE, a regular sequence between the minimum and the maximum of the observations is used. Default is FALSE.

number_y

an integer value indicating the number of y thresholds (and therefore the number of regressions) to perform the test. Default is length(Y).

Value

A data frame with the following elements:

Examples

1
2
3
4
if(interactive()){
X <- as.factor(rbinom(n=100, size = 1, prob = 0.5))
Y <- ((X==1)*rnorm(n = 50,0,1)) + ((X==0)*rnorm(n = 50,0.5,1))
res_perm <- test_perm(Y,data.frame(X=X),n_perm=10)}

ccdf documentation built on Sept. 24, 2021, 9:07 a.m.