Description Usage Arguments Details Value Examples
View source: R/calculateVarianceExplained.R
Method to calculate variance explained by the MOFA model for each view and latent factor.
As a measure of variance explained for gaussian data we adopt the coefficient of determination (R2).
For non-gaussian views the calculations are based on the normally-distributed pseudo-data
(for more information on the non-gaussian model
see Supplementary Methods of the MOFA paper or Seeger & Bouchard, 2012).
1 | calculateVarianceExplained(object, views = "all", factors = "all")
|
object |
a trained |
views |
character vector with the view names, or numeric vector with view indexes. Default is 'all' |
factors |
character vector with the factor names, or numeric vector with the factor indexes. Default is 'all' |
This function takes a trained MOFA model as input and calculates for each view the coefficient of determination (R2), i.e. the proportion of variance in the data explained by the MOFA factor(s) (both jointly and for each individual factor). In case of non-Gaussian data the variance explained on the Gaussian pseudo-data is calculated.
a list with matrices with the amount of variation explained per factor and view and the total variance explained per view.
1 2 3 4 5 6 7 8 9 | # Using an existing trained model on the CLL data
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFA_CLL <- loadModel(filepath)
calculateVarianceExplained(MOFA_CLL)
# Using an existing trained model on the scMT data
filepath <- system.file("extdata", "scMT_model.hdf5", package = "MOFAdata")
MOFA_scMT <- loadModel(filepath)
calculateVarianceExplained(MOFA_scMT)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.