bhpm.convergence.diag {bhpm} R Documentation

## Convergence Diagnostics of the Simulation

### Description

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

### Usage

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


### Arguments

 raw The output from a model simulation. debug_diagnostic Unused parameter.

### Details

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 diagnotics 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 bhpm.convergence.diag will contain different variables. Columns which may be used to indentify the individual samples are Trt.Grp, Outcome.Grp, Outcome, and Cluster.

R. Carragher

### Examples

data(bhpm.cluster.data1)
data <- subset(bhpm.cluster.data1, Cluster == '0.0-180.0' | Cluster == '180.0-360.0')
raw = bhpm.npm(data, burnin = 100, iter = 200)
conv = bhpm.convergence.diag(raw)

data(bhpm.cluster.data1)
raw = bhpm.npm(bhpm.cluster.data1)
conv = bhpm.convergence.diag(raw)



[Package bhpm version 1.7 Index]