View source: R/check_cdt_samples_convergence.R
check_cdt_samples_convergence | R Documentation |
check_cdt_samples_convergence
Checking convergence of an MCMC chain by
using the Gelman-Rubin algorithm
check_cdt_samples_convergence(cdt_samples)
cdt_samples |
the |
This function splits an MCMC chain in two halves and uses the Gelman-Rubin algorithm to assess convergence of the chain by comparing its two halves.
TRUE if the Gelman Rubin test for convergence was successful, FALSE otherwise
Anne Cori
estimate_R
## Not run:
## Note the following examples use an MCMC routine
## to estimate the serial interval distribution from data,
## so they may take a few minutes to run
## load data on rotavirus
data("MockRotavirus")
## estimate the serial interval from data
SI_fit <- coarseDataTools::dic.fit.mcmc(dat = MockRotavirus$si_data,
dist="G",
init_pars=init_mcmc_params(MockRotavirus$si_data, "G"),
burnin = 1000,
n.samples = 5000)
## use check_cdt_samples_convergence to check convergence
converg_diag <- check_cdt_samples_convergence(SI_fit@samples)
converg_diag
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.