Learn R Programming

BeviMed (version 3.0)

stop_chain: Apply the MCMC algorithm in blocks until conditions are met

Description

Sample blocks of a given size until either the estimated log marginal likelihood falls within a given confidence interval, there is sufficient confidence that the log Bayes factor of model gamma = 1 to model gamma = 0 is at most a certain quantity, or a certain number of blocks have been sampled.

Usage

stop_chain(y, blocks_remaining, start_zs, start_logit_omegas, start_log_phis,
  temperatures, tolerance = 1, confidence = 0.95, simulations = 1000,
  tau0_shape = c(1, 1), BF_threshold = -Inf,
  y_log_lik_t_equals_1_traces = matrix(ncol = length(temperatures), nrow = 0),
  full_block_traces = list(), verbose = FALSE, ...)

Arguments

y
Logical vector of case (TRUE) control (FALSE) status.
blocks_remaining
Maximum number of blocks left before termination.
start_zs
Initial (logical) z-matrix.
start_logit_omegas
Initial values of logit_omega (numeric vector - one value per chain).
start_log_phis
Initial values of log_phi (numeric vector - one value per chain).
temperatures
Numeric vector of temperatures of power posteriors. One chain will be created for each element of the vector at the corresponding temperature.
tolerance
Maximum width for confidence_interval of log marginal likelihood to allow before stopping the chain.
confidence
Numeric value of statistical confidence with which returning interval should contain the true value.
simulations
Integer value of number of simulations to use in estimation of the confidence interval.
tau0_shape
Beta shape hyper-priors for prior on rate of case labels.
BF_threshold
Numeric value used to determine whether to stop the sampling procedure after successive blocks. If we are confident (to the level of confidence) that the log Bayes factor between models gamma = 1 and gamma = 0 is under this value, we stop the sampling as soon as possible.
y_log_lik_t_equals_1_traces
Numeric matrix of log probabilities of y at different temperatures (columns) in different iterations (rows).
full_block_traces
List of outputs of calls to MCMC routine.
verbose
To print execution progress or not.
...
Other arguments passed to call_cpp

Value

An object of class BeviMed.