The package is implemented in a similar way as the bayesTFR
package and thus, many functions have their equivalents in bayesTFR.
The main functions of the package are:
run.mig.mcmc: Runs a Markov Chain Monte Carlo (MCMC) simulation.
It results in posterior samples of the model parameters.
mig.predict: Using the posterior parameter samples, trajectories of future
net migration rates are generated for all countries or given locations.
The following functions can be used to analyze results:
mig.trajectories.plot: Shows the posterior trajectories for a given location, including the median and given probability intervals.
mig.trajectories.table: Shows a tabular form of the posterior trajectories for a given location.
mig.map, mig.ggmap and mig.map.gvis: Show a world map of migration rates
for a given projection or observed period, or for country-specific parameter estimates.
mig.partraces.plot and mig.partraces.cs.plot: Plot the MCMC traces
of country-independent parameters and country-specific parameters, respectively.
mig.pardensity.plot and mig.pardensity.cs.plot: Plot the posterior density of the
country-independent parameters and country-specific parameters, respectively.
summary.bayesMig.mcmc.set: Summary method for the MCMC results.
summary.bayesMig.prediction: Summary method for the prediction results.
For MCMC diagnostics, function mig.coda.list.mcmc creates an object of type
“mcmc.list” that can be used with the coda package.
Furthermore, function mig.diagnose analyzes the MCMCs using the
Raftery diagnostics implemented in the coda package and gives information
about parameters that did not converge.
Existing results can be accessed using the get.mig.mcmc (estimation) and
get.mig.prediction (prediction) functions.
Existing convergence diagnostics can be accessed using the get.mig.convergence and
get.mig.convergence.all functions.
Historical data on migration rates are taken from the wpp2019 (default), wpp2022 or wpp2017 package,
depending on users settings. Alternatively, users can input their own data. These can be either
5-year or annual time series. An example file with historical annual US migration rates is included
in the package. Its usage is shown in the Example of mig.predict.