get_accessors: Accessor Functions for SAN Model Outputs

get_modelR Documentation

Accessor Functions for SAN Model Outputs

Description

The functions get_model, get_time, get_params, get_sim, and get_seed_best_run provide convenient access to specific components of model output objects of class SANmcmc (fitted via MCMC) or SANvi (fitted via variational inference).

Specifically:

  • get_model: returns a character string specifying the model type used;

  • get_time: returns the total runtime of the estimation procedure;

  • get_params: returns a list containing data and prior hyperparameters;

  • get_sim: returns the fitted quantities, such as posterior draws (MCMC) or variational estimates (VI);

  • get_seed_best_run: (only for SANvi) returns the random seed associated with the run that achieved the highest ELBO.

Usage

get_model(object, ...)

## S3 method for class 'SANvi'
get_model(object, ...)

## S3 method for class 'SANmcmc'
get_model(object, ...)

get_time(object, ...)

## S3 method for class 'SANvi'
get_time(object, ...)

## S3 method for class 'SANmcmc'
get_time(object, ...)

get_params(object, ...)

## S3 method for class 'SANvi'
get_params(object, ...)

## S3 method for class 'SANmcmc'
get_params(object, ...)

get_sim(object, ...)

## S3 method for class 'SANvi'
get_sim(object, ...)

## S3 method for class 'SANmcmc'
get_sim(object, ...)

get_seed_best_run(object, ...)

## S3 method for class 'SANvi'
get_seed_best_run(object, ...)

Arguments

object

An object of class SANmcmc or SANvi, as returned by fit_fSAN.

...

ignored.

Value

The requested component from the fitted model object. See the function descriptions above for details.

Examples

set.seed(123)
y <- c(rnorm(40, 0, 0.3), rnorm(20, 5, 0.3))
g <- c(rep(1:6, each = 10))

out <- fit_fSAN(y = y, group = g, est_method = "MCMC",
                mcmc_param = list(nrep = 500, burn = 200))

get_model(out)
get_time(out)
hp <- get_params(out)
sims <- get_sim(out)


sanba documentation built on Aug. 8, 2025, 6:15 p.m.