c212.convergence.diag {c212}R Documentation

Convergence Diagnostics of the Simulation


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.


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



The output from a model simulation.


Unused parameter.


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.


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:

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,

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


R. Carragher


raw = c212.BB(c212.trial.data, burnin = 100, iter = 200)
conv = c212.convergence.diag(raw)

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

## End(Not run)

[Package c212 version 0.98 Index]