View source: R/lambda_statistic.R
compute_lambda | R Documentation |
This function calculates the proportions of variation explained by batch, group, and residual for each gene using two-way ANOVA and computes the lambda index based on these three proportions.
compute_lambda(dat, batchind, groupind)
dat |
Numeric matrix of dimension (genes x samples) where each row represents one gene's expression across samples. |
batchind |
Factor or numeric vector of length = ncol(dat); batch indicator for each sample |
groupind |
Factor or numeric vector of length = ncol(dat); biological group label/indicator for each sample. |
Named numeric vector with elements:
Proportion of total variance explained by batch effects.
Proportion of total variance explained by group effects.
Proportion of total variance that is residual noise.
Raw lambda index = total SS_batch / total SS_group.
Adjusted lambda = lambda_raw * ResidV/(1-ResidV).
library(scran)
se <- mockSCE()
res <- BatchQC::compute_lambda(assays(se)[["counts"]],
colData(se)$Mutation_Status,
colData(se)$Treatment)
print(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.