findBurnIn: Find burn-in

View source: R/findBurnIn.R

findBurnInR Documentation

Find burn-in

Description

Given a chains of MCMC output, this function finds an appropriate burn-in across for the chain. It does this by calculating the effective smaple size (ESS) for each variable at a number of potential burn-in values and then selecting the burn-in value for which the sum of these is maximised. This method is somewhat approximate (as it assumes a common order of magnitude for each ESS time series) so we reccomend combining this with makeESSPlots to check if it makes sense.

Usage

findBurnIn(
  mcmc_data,
  max_burn_in = ifelse(is.data.frame(mcmc_data) | coda::is.mcmc(mcmc_data),
    nrow(mcmc_data), nrow(mcmc_data[[1]]))/2,
  step_size = round(max_burn_in/50)
)

Arguments

mcmc_data

A mcmc object (as per the coda package).

max_burn_in

The maximum burn-in value to test against. Defaults to half the number of samples present.

step_size

The granularity of burn-in values to test (i.e. the distance between subsequent values). Defaults to 0.02 of the max_burn_in.

Value

An integer. The reccomended burn in for the current chain.


stcolema/mdiHelpR documentation built on July 28, 2024, 5:41 a.m.