The functions compute the Raftery diagnostics for each parameter of MCMCs of phase II (tfr.raftery.diag
) and phase III (tfr3.raftery.diag
), taking median over all chains.
tfr.raftery.diag(mcmc = NULL,
sim.dir = file.path(getwd(), "bayesTFR.output"),
burnin = 0, country = NULL,
par.names = tfr.parameter.names(trans = TRUE),
par.names.cs = tfr.parameter.names.cs(trans = TRUE, back.trans = FALSE),
country.sampling.prop = 1, verbose=TRUE, …)tfr3.raftery.diag(mcmc = NULL,
sim.dir = file.path(getwd(), "bayesTFR.output"),
burnin = 0, country = NULL,
par.names = tfr3.parameter.names(),
par.names.cs = tfr3.parameter.names.cs(),
country.sampling.prop = 1, verbose=TRUE, …)
A bayesTFR.mcmc
or bayesTFR.mcmc.set
object.
Directory with the MCMC simulation results. Only used if mcmc
is NULL
.
Burnin.
Name or code of a country. If it is given, country-specific parameters are reduced to parameters of that country.
Names of country-independent parameters for which the Raftery diagnostics should be computed.
Names of country-specific parameters for which the Raftery diagnostics should be computed.
Proportion of countries that are included in the diagnostics. It should be between 0 and 1. If it is smaller than 1, the countries are randomly sampled. It is only relevant if par.names.cs
is not NULL
.
Logical switching log messages on and off.
Additional arguments passed to the coda.list.mcmc
function.
List with the components:
2-d array of \(N\) values (processed as described in Details) with two rows: first corresponding to q=0.025, second corresponding to q=0.975. Each column corresponds to one parameter.
2-d array of the same structure as Nmedian
, containing the burnin values (processed as described in Details).
List with two elements, each of which is a data frame containing columns “parameter.name”, “chain.id”, and “N”. These are parameters for which the computed value of Raftery diagnostics \(N\) is larger than the total number of finished iterations summed over all chains. The first element of the list corresponds to q=0.025, second corresponds to q=0.975.
List of the same structure as not.converged.parameters
. The parameters included are those for which the computed value of Raftery diagnostics \(N\) is larger than the number of finished iterations in the corresponding chain.
Data frame containing columns “parameter.name”, “chain.id”, “N0.025”, and “N0.975”. Each row gives \(N\) computed with the two different \(q\) for each country-independent parameter and chain.
The same as N.country.indep
, but here the country-specific parameters are considered.
2-d array of \(N\) values for country-specific parameters containing medians over chains.
List with elements '0.025', '0.975' and median
. The first two elements are matrices with one row per chain and one column per parameter. They contain values of thin
that makes the MCMC independent, for q=0.025 and q=0.975, respectively. The median
element is of the same structure as Nmedian
, containing medians ove rows in the two matrices in this list.
Vector with elements used
(number of countries used in this diagnostics) and total
(number of countries that this mcmc
object was estimated on).
The Raftery diagnostics is computed for each parameter, using coda's raftery.diag
with r=0.0125, q=0.025 and q=0.975. Values of \(N\) and burnin are taken as the median over chains. For each country-specific parameter, the maximum over all included countries of such medians is taken.