# 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")
## get clever initial values for shape and scale of a Gamma distribution
## fitted to the the data MockRotavirus$si_data
clever_init_param <- init_mcmc_params(MockRotavirus$si_data, "G")
## estimate the serial interval from data using a clever starting point for
## the MCMC chain
SI_fit_clever <- coarseDataTools::dic.fit.mcmc(dat = MockRotavirus$si_data,
dist = "G",
init.pars = clever_init_param,
burnin = 1000,
n.samples = 5000)
## estimate the serial interval from data using a random starting point for
## the MCMC chain
SI_fit_naive <- coarseDataTools::dic.fit.mcmc(dat = MockRotavirus$si_data,
dist = "G",
burnin = 1000,
n.samples = 5000)
## use check_cdt_samples_convergence to check convergence in both situations
converg_diag_clever <- check_cdt_samples_convergence(SI_fit_clever@samples)
converg_diag_naive <- check_cdt_samples_convergence(SI_fit_naive@samples)
converg_diag_clever
converg_diag_naive
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab