joint.male.predict: Prediction of the Joint Female-Male Model

e0.jmale.predictR Documentation

Prediction of the Joint Female-Male Model

Description

Prediction of the joint female-male model of life expectancy, as described in Raftery et al. (2014, 2012) and Lalic (2011).

Usage

e0.jmale.predict(e0.pred, estimates = NULL, gap.lim = c(0, 18), 
    max.e0.eq1.pred = 86, my.e0.file = NULL, my.locations.file = NULL,
    save.as.ascii = 1000, resample.outrange = TRUE, verbose = TRUE, ...)

Arguments

e0.pred

Object of class bayesLife.prediction containing female projections of life expectancy.

estimates

List of the same structure as returned by e0.jmale.estimate, containing the model estimation results. If it is not given, the e0.jmale.estimate function is invoked.

gap.lim

Vector of length two giving the minimum and maximum bounds for the female-male life expectancy gaps. See argument resample.outrange for two ways of handling gaps that fall outside of this range.

max.e0.eq1.pred

Maximum female life expectancy for male projections handled by the first equation (parameter M in Equation (1) in Raftery et al. (2012)).

my.e0.file

File name containing user-specified male time series for one or more countries. The function replaces the corresponding country data from the WPP dataset by values in this file. Only columns are replaced that match column names of the WPP dataset.

my.locations.file

File name containing user-specified locations if different from the default UNlocations dataset. It should be the same file as passed to run.e0.mcmc for female life expectancy.

save.as.ascii

Either a number determining how many trajectories should be converted into an ASCII file, or “all” in which case all trajectories are converted. It should be set to 0, if no conversion is desired.

resample.outrange

Logical indicating if values outside of the allowed gap range given by gap.lim should be resampled. If set to FALSE, such values are truncated instead.

verbose

Logical switching log messages on and off.

...

Further arguments passed to e0.jmale.estimate.

Details

If no estimates are given, the function invokes an estimation by calling e0.jmale.estimate. Using those estimates, the male life expectancy is projected forward in time (as a function of a female-male gap), using the female predictions from e0.pred. The initial male data point is extracted from the male WPP dataset (e0M) and possibly partly replaced by any user-specified data given in my.e0.file.

The resulting trajectory files are stored in a subdirectory of the female prediction directory, called ‘joint_male’. Furthermore, an object of class bayesLife.prediction is created and added to e0.pred as a component called joint.male.

The predicted gaps can be viewed using the e0.gap.plot function.

Value

Updated e0.pred object where a new component was added, called joint.male. It is also an object of class bayesLife.prediction and it contains results from this prediction.

Author(s)

Hana Sevcikova

References

A. E. Raftery, N. Lalic, P. Gerland (2014). Joint Probabilistic Projection of Female and Male Life Expectancy. Demographic Research, 30:795-822.

A. E. Raftery, N. Li, H. Sevcikova , P. Gerland, G. K. Heilig (2012). Bayesian probabilistic population projections for all countries. Proceedings of the National Academy of Sciences 109:13915-13921.

Lalic, N. (2011). Master's thesis at the Department of Statistics, University of Washington.

See Also

e0.jmale.estimate, get.e0.jmale.prediction, e0.predict, e0.gap.plot

Examples

## Not run: 
sim.dir <- tempfile()
m <- run.e0.mcmc(sex = 'F', nr.chains = 1, iter = 30, thin = 1, output.dir = sim.dir)
pred <- e0.predict(m, burnin = 15, verbose = FALSE, save.as.ascii = 0, 
                    predict.jmale = FALSE)
both.pred <- e0.jmale.predict(pred)
e0.trajectories.plot(both.pred, 'Guatemala') # Female
e0.trajectories.plot(get.e0.jmale.prediction(both.pred), 'Guatemala') # Male

# Marginal distribution of the sex-specific projections
e0.trajectories.plot(both.pred, 'GTM', both.sexes = TRUE,  pi = 80)

# Plotting the gaps
e0.gap.plot(both.pred, 'GTM')

# Joint distribution of the sex-specific projections
e0.joint.plot(both.pred, 'Guatemala', pi = 80, years = c(2013, 2043, 2093))

unlink(sim.dir, recursive = TRUE)

## End(Not run)

bayesLife documentation built on Sept. 16, 2023, 9:07 a.m.