get_variance_explained: Get variance explained values

View source: R/get_methods.R

get_variance_explainedR Documentation

Get variance explained values

Description

Extract the latent factors from the model.

Usage

get_variance_explained(
  object,
  groups = "all",
  views = "all",
  factors = "all",
  as.data.frame = FALSE
)

Arguments

object

a trained MOFA object.

groups

character vector with the group name(s), or numeric vector with the group index(es). Default is "all".

views

character vector with the view name(s), or numeric vector with the view index(es). Default is "all".

factors

character vector with the factor name(s), or numeric vector with the factor index(es). Default is "all".

as.data.frame

logical indicating whether to return a long data frame instead of a matrix. Default is FALSE.

Value

A list of data matrices with variance explained per group or a data.frame (if as.data.frame is TRUE)

Examples

# Using an existing trained model
file <- system.file("extdata", "model.hdf5", package = "MOFA2")
model <- load_model(file)

# Fetch variance explained values (in matrix format)
r2 <- get_variance_explained(model)

# Fetch variance explained values (in data.frame format)
r2 <- get_variance_explained(model, as.data.frame = TRUE)


bioFAM/MOFA2 documentation built on June 12, 2024, 3:57 p.m.