Learn R Programming

SANvi (version 0.1.1)

extract_best: 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)

Value

the single best run, an object of class SANvb.

Arguments

object

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

Examples

Run this code
# \donttest{
# 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)
# }

Run the code above in your browser using DataLab