getExpectations: getExpectations

Description Usage Arguments Details Value Examples

View source: R/getMethods.R

Description

Function to extract the expectations from the (variational) posterior distributions of a trained MOFAmodel object.

Usage

1
getExpectations(object, variable, as.data.frame = FALSE)

Arguments

object

a trained MOFAmodel object.

variable

variable name: 'Z' for factors, 'W' for weights, 'Tau' for noise, 'Y' for pseudodata, 'Theta' for feature-wise spike-and-slab sparsity, 'Alpha' for view and factor-wise ARD sparsity

as.data.frame

logical indicating whether to output the result as a long data frame, default is FALSE.

Details

Technical note: MOFA is a Bayesian model where each variable has a prior distribution and a posterior distribution. In particular, to achieve scalability we used the variational inference framework, thus true posterior distributions are replaced by approximated variational distributions. This function extracts the expectations of the variational distributions, which can be used as final point estimates to analyse the results of the model.
The priors and variational distributions of each variable are extensively described in the supplementary methods of the original paper.

Value

the output varies depending on the variable of interest:

Examples

1
2
3
4
5
# load a trained MOFAmodel object
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFAobject <- loadModel(filepath)
# get expectations of Alpha as matrix
getExpectations(MOFAobject, variable="Alpha")

MOFA documentation built on Feb. 11, 2021, 2:01 a.m.