HMD2MH: Format data from the Human Mortality Database for use in the...

Description Usage Arguments Details Value References See Also

View source: R/HMD2MH.r

Description

Format data from the Human Mortality Database for use in the MortHump package

Usage

1
2
HMD2MH(country, year, dim = "period", xtra = FALSE, sex, min = 0,
  max = NULL, username = NULL, password = NULL, path = NULL)

Arguments

country

HMD population letter code

year

year (or birth cohort) for which the data is required

dim

dimension (period or cohort)

xtra

if TRUE extrapolates non-extinct cohorts

sex

sex for which the data is required ("females", "males" or "total")

min

age at which the data should be left-censored

max

age at which the data should be right-censored

username

personal HMD username for web access

password

personal HMD password for web access

path

path to the HMD folder for local access (containing the country folders)

Details

Two methods are available to access the data, either online or locally. Web access is advised to guarantee the most recent data, but can be slow. For a fast access, download first the complete zipped data files (choose "All countries for the HMD"), and then indicate the path to the general folder. The data collection method will be adapted depending if you indicate a path or a username and a password.

If you choose cohort data, you have the option of either work with the observed data, or to extrapolate the non-extinct cohorts. In the latter case, a variant of the Lee-Carter model is used to extrapolate the period mortality rates, which are used to identify cohort rates in the diagonal of the Lexis matrix. This option uses a variant of the Lee-Carter model, namely the functional model proposed by Hyndman and Ullah (2007) and available in the demography package.

The list of available countries and period coverage can be found on the HMD website. This list is also accessible with the function getHMDcountries() from the HMDHFDplus package.

The max argument is designed to deal with either the presence of a mortality plateau among centenarians, which can be diffcult to capture with parametric models, or a high level of stochasticity at old ages due to a small number of survivors. It is recommended to keep the value of max above 80 or 90.

Value

A data frame containing the following variables.

x

vector of ages.

d

vector of death counts.

n

vector of population exposures.

m

vector of death rates.

References

Human Mortality Database. University of California, Berkeley (USA), and Max Planck Institute for Demographic Research (Germany). Available at www.mortality.org or www.humanmortality.de.

See Also

This function makes use of the functions readHMD and readHMDweb from the HMDHFDplus package.


MortHump documentation built on Jan. 24, 2018, 6:02 p.m.