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

e0.jmale.predictR Documentation

Prediction of the Joint Female-Male Model


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


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, = 1000, resample.outrange = TRUE, verbose = TRUE, ...)



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


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.


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.


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


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.


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.

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.


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.


Logical switching log messages on and off.


Further arguments passed to e0.jmale.estimate.


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 function.


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.


Hana Sevcikova


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,


## 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, = 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, '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.