% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CIBERSORT.R
\name{doPerm}
\alias{doPerm}
\title{Permutation Test for CIBERSORT}
\usage{
doPerm(perm, X, Y, absolute, abs_method, seed = NULL)
}
\arguments{
\item{perm}{Integer. Number of permutations to perform (\eqn{\ge}100 recommended for
reliable p-value estimation).}

\item{X}{Matrix or data frame containing signature matrix (predictor variables).}

\item{Y}{Numeric vector containing the mixture sample expression.}

\item{absolute}{Logical indicating whether to use absolute space for weights.}

\item{abs_method}{String specifying the method for absolute space weights:
`"sig.score"` or `"no.sumto1"`.}

\item{seed}{Integer. Random seed for reproducibility. If NULL (default),
uses current random state.}
}
\value{
List containing:
\describe{
  \item{dist}{Numeric vector of correlation coefficients from permutations}
}
}
\description{
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.
}
\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)
}
