get_banocc_output: Takes a model fit from BAnOCC, evaluates convergence and...

View source: R/get_banocc_output.R

get_banocc_outputR Documentation

Takes a model fit from BAnOCC, evaluates convergence and generates appropriate convergence metrics and inference

Description

Takes a model fit from BAnOCC, evaluates convergence and generates appropriate convergence metrics and inference

Usage

get_banocc_output(banoccfit, conf_alpha = 0.05, get_min_width = FALSE,
  calc_snc = TRUE, eval_convergence = TRUE, verbose = FALSE,
  num_level = 0)

Arguments

banoccfit

Either a stanfit object (the Fit element returned by run_banocc), or the list returned by a call to run_banocc.

conf_alpha

The percentage of the posterior density outside the credible interval. That is, a 1-conf_alpha * 100% credible interval will be returned.

get_min_width

A boolean value: should the minimum CI width that includes zero be calculated?

calc_snc

Boolean: should the scaled neighborhood criterion be calculated?

eval_convergence

Boolean: if 'TRUE', convergence will be evaluated using the Rhat statistic, and the fit output (estimates, credible intervals, etc.) will be missing if this statistic does not indicate convergence.

verbose

Print informative statements as the function executes?

num_level

The number of indentations to add to the output when verbose = TRUE.

Value

Returns a named list with the following elements:

CI

The 1-conf_alpha * 100% credible intervals

Estimates.median

The correlation estimates, which are the marginal posterior medians

Min.width

Only present if the get_min_width argument is TRUE. The minimum CI width that includes zero for each correlation.

SNC

Only present if the calc_snc argument is TRUE. The scaled neighborhood criterion for each correlation.

Fit

The stanfit object returned by the call to run_banocc.

Data

Only present if the banoccfit argument is specified as the output of a call to run_banocc. It will be missing if banoccfit is specified as a stanfit object.

See Also

vignette("banocc-vignette") for more examples.

Examples

data(compositions_null)
  ## Not run: 
    compiled_banocc_model <- rstan::stan_model(model_code=banocc_model)
    b_fit <- run_banocc(C=compositions_null,
                            compiled_banocc_model=compiled_banocc_model)
    b_output <- get_banocc_output(banoccfit=b_fit)
  
## End(Not run)


biobakery/banocc documentation built on March 26, 2024, 11:41 p.m.