Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

check_cdt_samples_convergence

Checking convergence of an MCMC chain by using the Gelman-Rubin algorithm


Description

check_cdt_samples_convergence Checking convergence of an MCMC chain by using the Gelman-Rubin algorithm

Usage

check_cdt_samples_convergence(cdt_samples)

Arguments

cdt_samples

the @sample slot of a cd.fit.mcmc S4 object (see package coarseDataTools)

Details

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.

Value

TRUE if the Gelman Rubin test for convergence was successful, FALSE otherwise

Author(s)

Anne Cori

See Also

Examples

## 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)

EpiEstim

Estimate Time Varying Reproduction Numbers from Epidemic Curves

v2.2-4
GPL (>= 2)
Authors
Anne Cori [aut, cre] (<https://orcid.org/0000-0002-8443-9162>), Simon Cauchemez [ctb], Neil M. Ferguson [ctb] (<https://orcid.org/0000-0002-1154-8093>), Christophe Fraser [ctb] (<https://orcid.org/0000-0003-2399-9657>), Elisabeth Dahlqwist [ctb] (<https://orcid.org/0000-0001-5797-6803>), P. Alex Demarsh [ctb], Thibaut Jombart [ctb] (<https://orcid.org/0000-0003-2226-8692>), Zhian N. Kamvar [ctb] (<https://orcid.org/0000-0003-1458-7108>), Justin Lessler [ctb] (<https://orcid.org/0000-0002-9741-8109>), Shikun Li [ctb], Jonathan A. Polonsky [ctb] (<https://orcid.org/0000-0002-8634-4255>), Jake Stockwin [ctb], Robin Thompson [ctb] (<https://orcid.org/0000-0001-8545-5212>), Rolina van Gaalen [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.