Functions tfr.diagnose
and tfr3.diagnose
run convergence diagnostics of existing TFR MCMCs for phase II and phase III, respectively, using the raftery.diag
function from the coda package. has.mcmc.converged
checks if the existing diagnostics converged.
tfr.diagnose(sim.dir, thin = 80, burnin = 2000, express = FALSE,
country.sampling.prop = NULL, keep.thin.mcmc=FALSE, verbose = TRUE)
tfr3.diagnose(sim.dir, thin = 60, burnin = 10000, express = TRUE,
country.sampling.prop = NULL, verbose = TRUE, ...)
has.mcmc.converged(diag)
has.mcmc.converged
returns a logical value determining if there is convergence or not.
tfr.diagnose
and tfr3.diagnose
return an object of class bayesTFR.convergence
with components:
Table containing all not-converged parameters. Its columns include ‘Total iterations needed’ and ‘Remaining iterations’.
Number of rows in result
that correspond to country-independent paramters. These rows are groupped at the beginning of the table.
Result of tfr.raftery.diag
processed on country-independent parameters.
Result of tfr.raftery.diag
processed on country-specific parameters.
Number of additional iterations suggested in order to achieve convergence.
Total number of iterations of the original unthinned set of chains.
Suggestion for number of trajectories in generating predictions.
Burnin used.
Thinning interval used.
Vector of character strings containing the result status. Possible values: ‘green’, ‘red’.
Object of class bayesTFR.mcmc.set
that corresponds to the original set of MCMCs on which the diagnostics was run.
If keep.thin.mcmc
is TRUE
, it is an object of class bayesTFR.mcmc.set
that corresponds to the thinned mcmc set on which the diagnostics was run, otherwise NULL
.
Value of the input argument express
.
Vector with elements used
- number of countries used in this diagnostics, and total
- number of countries that this mcmc.set
object was estimated on.
Directory with the MCMC simulation results.
Thinning interval.
Number of iterations to be discarded from the beginning of the parameter traces.
Logical. If TRUE
, the convergence diagnostics is run only on the country-independent parameters. If FALSE
, the country-specific parameters are included in the diagnostics. The number of countries can be controlled by country.sampling.prop
.
Proportion of countries that are included in the diagnostics. If it is NULL
and express=FALSE
, all countries are included. Setting here a number between 0 and 1, one can limit the number of countries which are then randomly sampled. Note that for long MCMCs, this argument may significantly influence the run-time of this function.
Logical. If TRUE
the thinned traces used for computing the diagnostics are stored on disk (see create.thinned.tfr.mcmc
). It is only available for phase II MCMCs.
Logical switching log messages on and off.
Object of class bayesTFR.convergence
.
Not used.
Hana Sevcikova, Leontine Alkema, Adrian Raftery
The diagnose functions invoke the tfr.raftery.diag
(or tfr3.raftery.diag
) function separately for country-independent parameters and for country-specific parameters. It results in two possible states: red, i.e. it did not converge, and green, i.e. it converged.
The resulting object from tfr.diagnose
is stored in
{sim.dir}/diagnostics/bayesTFR.convergence_{thin}_{burnin}.rda
and can be accessed using the function get.tfr.convergence
. Function tfr3.diagnose
stores its result into
{sim.dir}/phaseIII/diagnostics/bayesTFR.convergence_{thin}_{burnin}.rda
which can be accessed via get.tfr3.convergence
.
tfr.raftery.diag
, raftery.diag
, summary.bayesTFR.convergence
, get.tfr.convergence
, create.thinned.tfr.mcmc