c212.convergence.diag: Convergence Diagnostics of the Simulation

Description Usage Arguments Details Value Author(s) Examples

View source: R/c212.convergence.R

Description

The function applies either Gelman-Rubin or the Geweke diagnostic to the raw output of model simulation (e.g. c212.BB). It returns the convergence diagnostics and, if applicable, the acceptance rates for the sampling distributions.

Usage

1
	c212.convergence.diag(raw, debug_diagnostic = FALSE)

Arguments

raw

The output from a model simulation.

debug_diagnostic

Unused parameter.

Details

parameter is time consuming. This function applies one of two convergence diagnostics to the raw output of a model simulation in order to allow convergence to be assessed. The two diagnostics are:

i) Gelman-Rubin diagnostic - used when there is more than one chain. A value close to 1 is consistent with an MCMC simulation which has converged. The ‘coda’ diagnostic returns a point estimate and upper confidence limits.

ii) Geweke diagnostic - used when there is a single chain. A Z-score which is consistent with a standard normal distribution is expected from an MCMC simulation which has converged.

The raw sample data is converted to ‘coda’ format (mcmc objects) and the ‘coda’ methods gelman.diag and geweke.diag are used to perform the checks.

Value

Returns a list of the diagnostics for each sampled variable. Each individual element of the list is a data.frame containing at least the columns type, which is the type of diagnostic (‘Gelman-Rubin’ or ‘Geweke’), stat, which is the value of the dignostic, and upper_ci which is the upper confidence interval for the Gelman-Rubin diagnostic. For the Geweke diagnostic upper_ci contains the value NA. Depending on the simulation performed the return from c212.convergence.diag will contain different variables. The return for a simulation from c212.1a is as follows:

1
2
3
4
5
list(sim_type, gamma.conv.diag, theta.conv.diag, mu.gamma.conv.diag,
                       mu.theta.conv.diag, sigma2.gamma.conv.diag,
                       sigma2.theta.conv.diag, mu.gamma.0.conv.diag,
                       mu.theta.0.conv.diag, tau2.gamma.0.conv.diag,
                       tau2.theta.0.conv.diag)

Additional columns which may be used to identify the individual samples are B, the body-system, and AE, the Adverse Event and interval.

Author(s)

R. Carragher

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(c212.trial.data)
raw = c212.BB(c212.trial.data, burnin = 100, iter = 200)
conv = c212.convergence.diag(raw)

## Not run: 
data(c212.trial.data)
raw = c212.BB(c212.trial.data)
conv = c212.convergence.diag(raw)

## End(Not run)

c212 documentation built on Sept. 8, 2020, 5:07 p.m.