hp {BayesMortalityPlus}R Documentation

Bayesian Heligman-Pollard curve for mortality table graduation


This function fits the Heligman-Pollard (HP) model following a Bayesian framework using Markov chain Monte Carlo techniques to sample the posterior distribution. Three model options are available: The Binomial and the Poisson models consider nine parameters, whereas the Log-Normal model considers eight parameters for modelling the HP curve.


hp(x, Ex, Dx, model = c("binomial", "lognormal", "poisson"),
 M = NULL, bn = NULL, thin = 10, m = rep(NA, 8), v = rep(NA, 8),
 inits = NULL, K = NULL, sigma2 = NULL, prop.control = NULL,
 reduced_model = FALSE)



Numeric vector of the ages.


Numeric vector with the exposure by age.


Numeric vector with the death counts by age.


Character string specifying the model to be adopted. The options are: "binomial", "lognormal" or "poisson".


Positive integer indicating the number of iterations of the MCMC run. The default value is 50000 iterations. For the reduced model, the default is 30000 iterations.


Non-negative integer indicating the number of iteration to be discarded as the burn-in period. The default value is half of the M value, rounded.


Positive integer specifying the period for saving samples. The default value is 10.


Numeric vector with the mean of the prior distributions for (A, B, C, D, E, F, G, H).


Numeric vector with the variance of the prior distributions for (A, B, C, D, E, F, G, H).


Numeric vector with the initial values for the parameters (A, B, C, D, E, F, G, H).


Number that specifies the extra parameter 'K' value for binomial and poisson models. It is considered only if model = "binomial" or model = "poisson". The default value is the optimal value.


Positive number that specifies initial value of sigma2 in lognormal model. It is considered only if model = "lognormal".


Positive number that is considered for tuning the acceptance rate of MCMC.


Logical value which determines if reduced model should be addressed. If 'TRUE' (default), the first term of the HP curve (infant mortality) is not considered.


The binomial model assumes that Dx, the death count for the age x, has a binomial distribution: Bin(Ex, qx), where qx is probability of death in age x. The poisson model assumes that Dx has a Poisson distribution: Po(Ex*qx). Both models consider the nine parameters HP curve, that was proposed by Heligman and Pollard (1980):

HP_x = A^{(x+B)^C} + De^{(-E(log(x/F))^2)} + GH^x/(1+KGH^x)

qx = 1-e^{(-HP_x)}

This approximation ensures that qx, which is a probability, is in the correct range.

The Log-Normal model assumes that the log odds of death qx/(1-qx) has Normal distribution with a constant variance for all the ages. This model was proposed by Dellaportas et al.(2001) and they consider the eighth parameters HP curve as follows:

log(qx/(1-qx)) = log(A^{(x+B)^C} + De^{-E(log(x/F))^2} + GH^x) + \epsilon_x,

where \epsilon_x has independent distributions Normal(0, sigma2) for all ages. More details of this model are available in Dellaportas, Smith e Stavropoulos (2001).

The reduced model does not consider the first term of the HP curve: A^{(x+B)^C}. In this case, A, B and C are fixed as zero.

All parameters, with the exception of the extra parameter K of the Binomial and the Poisson models that is the estimated optimal value, are estimated by the MCMC methods. Gibbs sampling for sigma2 and Metropolis-Hastings for parameters A, B, C, D, E, F, G and H. Informative prior distributions should help the method to converge quickly.


A HP class object.


A table with summaries measures of the parameters.


A list with the chains generated by MCMC.


A table with the data considered in fitted model.


A list with some informations of the fitted model like prior distributions mean and variance, initial values.


Dellaportas, P., Smith, A. F., and Stavropoulos, P. (2001). “Bayesian Analysis of Mortality Data.” Journal of the Royal Statistical Society: Series A (Statistics in Society) 164 (2). Wiley Online Library: 275–291.

Heligman, Larry, and John H Pollard. (1980). “The Age Pattern of Mortality.” Journal of the Institute of Actuaries (1886-1994) 107 (1). JSTOR: 49–80.

See Also

fitted.HP(), plot.HP(), print.HP() and summary.HP() for HP methods to native R functions fitted(), plot(), print() and summary().

expectancy.HP() and Heatmap.HP() for HP methods to compute and visualise the truncated life expectancy via expectancy() and Heatmap() functions.

hp_close() for close methods to expand the life tables and hp_mix() for mixing life tables.

plot_chain() to visualise the markov chains, respectively.


## Importing mortality data from the USA available on the Human Mortality Database (HMD):

## Selecting the exposure and death count of the 2010 male population ranging from 0 to 90 years old
USA2010 = USA[USA$Year == 2010,]
x = 0:90
Ex = USA2010$Ex.Male[x+1]
Dx = USA2010$Dx.Male[x+1]

## Fitting binomial model
fit = hp(x = x, Ex = Ex, Dx = Dx)

## Fitting lognormal model
## Specifying number of iterations, burn-in, thinning and the initial value of sigma2
fit = hp(x = x, Ex = Ex, Dx = Dx, model = "lognormal",
         M = 1000, bn = 0, thin = 10, sigma2 = 0.1)

## Fitting poisson model
## Specifying the prior distribution parameters for B and E and fixing K as 0.
fit = hp(x = x, Ex = Ex, Dx = Dx, model = "poisson",
         m = c(NA, 0.08, NA, NA, 9, NA, NA, NA),
         v = c(NA, 1e-4, NA, NA, 0.1, NA, NA, NA), K = 0)

## Using other functions available in the package:
## plotting (See "?plot.HP" in the BayesMortalityPlus package for more options):

## qx estimation (See "?fitted.HP" in the BayesMortalityPlus package for more options):

## chain's plot (See "?plot_chain" for more options):

[Package BayesMortalityPlus version 0.2.4 Index]