Learn R Programming

ccdf (version 1.1.4)

test_perm: Permutation test

Description

Permutation test

Usage

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:

  • score contains the test statistic for a given gene.

  • raw_pval contains the raw p-values for a given gene computed from n_perm permutations.

Examples

Run this code
# NOT RUN {
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)}
# }

Run the code above in your browser using DataLab