impute: Impute missing values from a fitted MOFA

View source: R/impute.R

imputeR Documentation

Impute missing values from a fitted MOFA

Description

This function uses the latent factors and the loadings to impute missing values.

Usage

impute(
  object,
  views = "all",
  groups = "all",
  factors = "all",
  add_intercept = TRUE
)

Arguments

object

a MOFA object.

views

character vector with the view name(s), or numeric vector with view index(es).

groups

character vector with the group name(s), or numeric vector with group index(es).

factors

character vector with the factor names, or numeric vector with the factor index(es).

  • response:gives mean for gaussian and poisson and probabilities for bernoulli.

  • link: gives the linear predictions.

  • inRange: rounds the fitted values from "terms" for integer-valued distributions to the next integer (default).

add_intercept

add feature intercepts to the imputation (default is TRUE).

Details

MOFA generates a denoised and condensed low-dimensional representation of the data that captures the main sources of heterogeneity of the data. This representation can be used to reconstruct the data, simply using the equation Y = WX. For more details read the supplementary methods of the manuscript.
Note that with impute you can only generate the point estimates (the means of the posterior distributions). If you want to add uncertainity estimates (the variance) you need to set impute=TRUE in the training options. See get_default_training_options.

Value

This method fills the imputed_data slot by replacing the missing values in the input data with the model predictions.

Examples

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

# Impute missing values in all data modalities
imputed_data <- impute(model, views = "all")

# Impute missing values in all data modalities using factors 1:3
imputed_data <- impute(model, views = "all", factors = 1:3)

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