diagnostic-quantities: Extract Diagnostic Quantities of 'OncoBayes2' Models

diagnostic-quantitiesR Documentation

Extract Diagnostic Quantities of OncoBayes2 Models

Description

Extract quantities that can be used to diagnose sampling behavior of the algorithms applied by Stan at the back-end of OncoBayes2.

Usage

## S3 method for class 'blrmfit'
log_posterior(object, ...)

## S3 method for class 'blrmfit'
nuts_params(object, pars = NULL, ...)

## S3 method for class 'blrmfit'
rhat(object, pars = NULL, ...)

## S3 method for class 'blrmfit'
neff_ratio(object, pars = NULL, ...)

Arguments

object

A blrmfit or blrmtrial object.

...

Arguments passed to individual methods.

pars

An optional character vector of parameter names. For nuts_params these will be NUTS sampler parameter names rather than model parameters. If pars is omitted all parameters are included.

Details

For more details see bayesplot-extractors.

Value

The exact form of the output depends on the method.

Examples

## Setting up dummy sampling for fast execution of example
## Please use 4 chains and 100x more warmup & iter in practice
.user_mc_options <- options(OncoBayes2.MC.warmup=10, OncoBayes2.MC.iter=20, OncoBayes2.MC.chains=1,
                            OncoBayes2.MC.save_warmup=FALSE)

example_model("single_agent", silent=TRUE)

head(log_posterior(blrmfit))

np <- nuts_params(blrmfit)
str(np)
# extract the number of divergence transitions
sum(subset(np, Parameter == "divergent__")$Value)

head(rhat(blrmfit))
head(neff_ratio(blrmfit))

## Recover user set sampling defaults
options(.user_mc_options)


OncoBayes2 documentation built on July 26, 2023, 5:30 p.m.