Performs permutation-based sampling to generate an empirical null distribution of correlation coefficients for p-value calculation in CIBERSORT analysis. Randomly samples from the mixture data to create null distributions.
Arguments
- perm
Integer. Number of permutations to perform (\(\ge\)100 recommended for reliable p-value estimation).
- X
Matrix or data frame containing signature matrix (predictor variables).
- Y
Numeric vector containing the mixture sample expression.
- absolute
Logical indicating whether to use absolute space for weights.
- abs_method
String specifying the method for absolute space weights: `"sig.score"` or `"no.sumto1"`.
- seed
Integer. Random seed for reproducibility. If NULL (default), uses current random state.
Examples
# Simulate data
set.seed(123)
X <- matrix(rnorm(100), nrow = 10)
rownames(X) <- paste0("Gene", 1:10)
colnames(X) <- paste0("Cell", 1:10)
Y <- rnorm(10)
names(Y) <- paste0("Gene", 1:10)
# Run permutation test
result <- doPerm(10, X, Y, absolute = FALSE, abs_method = "sig.score")
if (!is.null(result)) str(result)
#> List of 1
#> $ dist: num [1:10] 0.883 0.794 0.708 0.739 0.41 ...