Learn R Programming

ccdf (version 1.1.4)

permut: Permutation test when dist_permutations is specified

Description

Permutation test when dist_permutations is specified

Usage

permut(
  Y,
  X,
  Z = NULL,
  distance = "L2",
  n_perm,
  method = "logistic regression",
  parallel = TRUE,
  n_cpus = NULL,
  fast = TRUE
)

Arguments

Y

a numeric vector of size n containing the preprocessed expressions from n samples (or cells).

X

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

Z

a data frame containing numeric or factor vector(s) of size n containing the covariate(s).

method

a character string indicating which method to use to compute the CCDF, either 'linear regression', 'logistic regression' and 'permutations' or 'RF' for Random Forests. Default is 'linear regression' since it is the method used in the test.

#'@param 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.

fast

a logical flag indicating whether the fast implementation of logistic regression should be used. Only if 'dist_permutations' is specified. Default is TRUE.

Value

A data frame with the following elements:

  • score contains the test statistic for a given gene.

  • 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))
permut(Y,X,method="linear regression",n_perm=10,n_cpus=2)}
# }

Run the code above in your browser using DataLab