Description Usage Arguments Value
View source: R/parameterEstimation.R
Given principal component (PC) embeddings and a metadata table containing cell state assignments, sample identities, and batch identities, this function uses principal variance component analysis (PVCA) to deconvolute the sources of variation in each PC. For PVCA, this function fits a linear mixed effects model with sample and batch fit as random effects. We recommend that datasets have multiple samples and batches in order to accurately estimate the variance contributions of sample and batch.
1 2 3 4 5 6 7 8 9 10 11 | estimatePCVar(
pca,
npcs,
meta,
clusCol,
sampleCol,
batchCol,
parallel = FALSE,
mc.cores = 1,
save = NULL
)
|
pca |
The PC embeddings from a PCA (cell x PC). Every PC should contain a value for each cell. |
npcs |
The number of PCs whose variance will be deconvoluted. As this function's output is used as direct input for our simulation functions, this will determine how many PCs your generated datasets will contain (e.g. npcs = 20 here will mean that the generated datasets will contain 20 PCs). |
meta |
A metadata table that should include named columns containing: Cell IDs, cell state assignments, sample identities, and batch identities for each cell. |
clusCol |
The name of the metadata column containing the cell state cluster assignments for each cell. |
sampleCol |
The name of the metadata column containing the sample identities of each cell. |
batchCol |
The name of the metadata column containing batch identities of each cell. |
parallel |
Boolean determining whether the linear models will be fit in parallel (highly recommend) if possible. Computation time is determined by number of cells in the data you are fitting. |
mc.cores |
Number of cores used if models are being fit in parallel. |
save |
The path the models will be saved to if a directory is provided. While you can save the output of this function (variance estimates), you can save the fitted models if you wish tocheck their fitted values individually. |
Returns a list containing the following elements: a matrix containing the mean PC values for each cell state, a list where each element is the residual variance-covariance matrix for each cell state, a matrix containing the batch-associated variance for each cell state in each PC, a matrix containing the sample-associated variance for each cell state in each PC.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.