mig.diagnose {bayesMig} | R Documentation |
MCMC convergence diagnostics
Description
Runs convergence diagnostics of existing migration Markov chains
using the raftery.diag
function from the coda
package.
Usage
mig.diagnose(
sim.dir,
thin = 80,
burnin = 2000,
express = FALSE,
country.sampling.prop = NULL,
keep.thin.mcmc = FALSE,
verbose = TRUE
)
mig.raftery.diag(
mcmc = NULL,
sim.dir = NULL,
burnin = 0,
country = NULL,
par.names = NULL,
par.names.cs = NULL,
country.sampling.prop = 1,
verbose = TRUE,
...
)
estimate.a.hw(mcmc, burnin = 0, thin = NULL)
Arguments
sim.dir |
Directory with MCMC simulation results. |
thin |
Thinning interval. |
burnin |
Number of iterations to discard from the beginning of the parameter traces. |
express |
Logical. If |
country.sampling.prop |
Proportion of countries to include in the diagnostics. If it is |
keep.thin.mcmc |
Logical. If |
verbose |
Logical value. Switches log messages on and off. |
mcmc |
A |
country |
Name or code of a country. If it is given, only country-specific parameters parameters of that country are considered. |
par.names |
Names of country-independent parameters for which the Raftery diagnostics should be computed. By default all parameters are used. |
par.names.cs |
Names of country-specific parameters for which the Raftery diagnostics should be computed. By default all parameters are used. |
... |
Additional arguments passed to the |
Details
The mig.diagnose
function invokes the mig.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 is stored in
‘{sim.dir}/diagnostics/bayesMig.convergence_{thin}_{burnin}.rda’
and can be accessed using the function get.mig.convergence
.
Function has.mcmc.converged
from the bayesTFR package
can be used to check if the existing diagnostics converged.
For details on the mig.raftery.diag
function, see tfr.raftery.diag
.
The estimate.a.hw
function estimates an optimal value for the a.half.width
argument in run.mig.mcmc
.
Value
mig.diagnose
returns an object of class bayesMig.convergence
containing summaries of the convergence check inputs and outputs. It has the
same structure as bayesTFR.convergence
.
In addition it has an element a.hw.est
which is the estimated value for
the a.half.width
argument in run.mig.mcmc
.
See Also
tfr.raftery.diag
, raftery.diag
, get.mig.convergence
Examples
# See examples in ?bayesMig and ?get.mig.convergence