compareModels {MOFA} | R Documentation

## Compare different instances of trained `MOFAmodel`

### Description

Different objects of `MOFAmodel` are compared in terms of the final value of the ELBO statistics. For model selection the model with the highest ELBO value is selected. The height of the bar indicates the number of inferred factors and the color of the bar the value of the ELBO statistic.

### Usage

    compareModels(models, show_modelnames = FALSE)

### Arguments

`models` | a list containing `MOFAmodel` objects.
`show_modelnames` | boolean, whether to indicate the name of each model instance (names of the list in models) or not

### Value

a ggplot showing the number of factors and the ELBO statistics of the given models as a barplot

### Examples

    ### Example on simulated data
    # Simulate Data
    data <- makeExampleData()
    # Create MOFA model
    MOFAobject <- createMOFAobject(data)
    # Prepare MOFA model
    MOFAobject <- prepareMOFA(MOFAobject)
    # Train several instances of MOFA models
    n_inits <- 3
    MOFAlist <- lapply(seq_len(n_inits), function(i) runMOFA(MOFAobject, outfile=tempfile()))
    compareModels(MOFAlist)

[Package MOFA version 1.6.2 Index]