Learn R Programming

bayesTFR (version 7.4-2)

get.tfr.estimation: Get Past TFR Estimation

Description

Get past TFR estimation, including trajectories and quantiles if required.

Usage

get.tfr.estimation(mcmc.list = NULL, country = NULL, 
    sim.dir = NULL, burnin = 0, thin = 1, probs = NULL, adjust = TRUE,
    country.code = deprecated(), ISO.code = deprecated())

Value

tfr_table

Table storing the trajectories. It is a matrix with rows equal to number of trajectories, and column equal to number of time periods.

country.obj

A list storing information about the country which the trajectories and quantiles correspond to. It corresponds to the output of get.country.object.

tfr_quantile

Optional. A data.table object, storing the quantiles of estimates for each time period as specified by the probs argument. The time periods are contained in the year column.

Arguments

mcmc.list

Object of class bayesTFR.mcmc.set corresponding Phase II MCMCs. If it is NULL, the object is loaded from the directory given by sim.dir.

country

Name or numerical code of a country. It can also be given as ISO-2 or ISO-3 characters.

sim.dir

Directory with the MCMC simulation results. Only used if mcmc.list is NULL.

burnin

Burn-in for getting trajectories and quantiles. A positive burn-in \(x\) will remove first \(x\) iterations from each chain.

thin

Thin for getting trajectories and quantiles. Thinning level \(x\) greater than 1 will store one iteration per \(x\) samples.

probs

A vector of numbers between \([0,1]\) specifying which estimation quantiles should be outputted. If it is set to NULL no quantiles are returned.

adjust

Logical indicating whether the adjusted median and trajectories should be returned.

country.code, ISO.code

Deprecated arguments. Use argument country instead.

Author

Peiran Liu, Hana Sevcikova

Details

This function is used to obtain the TFR estimation trajectories as well as corresponding quantiles if the mcmc.list has been obtained while taking account for uncertainty about the past, i.e. uncertainty=TRUE in run.tfr.mcmc. Quantiles are included in the results if probs is not NULL.

Examples

Run this code
if (FALSE) {
sim.dir <- tempfile()
m <- run.tfr.mcmc(nr.chains = 1, iter = 10, output.dir = sim.dir, uncertainty = TRUE)
get.tfr.estimation(m, "Nigeria", probs = c(0.1, 0.5, 0.9))
unlink(sim.dir, recursive = TRUE)}

Run the code above in your browser using DataLab