extract_best {SANvi}R Documentation

Extract the best run from multiple trials

Description

A simple function to automatically extract the best run from a collection of fitted variational models.

Usage

extract_best(object)

Arguments

object

an object of class multistart, obtained from the variational_multistart function.

Value

the single best run, an object of class SANvb.

Examples


# Generate example dataset
set.seed(123)
y <- c(rnorm(100),rnorm(100,5))
g <- rep(1:2,rep(100,2))

# Estimate multiple models via variational inference
est <- variational_multistart(y, g, runs=5,
                              alpha_bar = 3, beta_bar = 3,
                              root=1234, warmstart = FALSE)

# Obtain best run
extract_best(est)


[Package SANvi version 0.1.1 Index]