Learn R Programming

⚠️There's a newer version (2.1.3) of this package.Take me there.

MortalityLaws: Parametric Mortality Models, Life Tables and HMD

Fit the most popular human mortality laws, and construct full and abridged life tables given various input indices. A mortality law is a parametric function that describes the dying-out process of individuals in a population during a significant portion of their life spans. For a comprehensive review of the most important mortality laws see Tabeau (2001). Function for downloading demographic data from the following sources are provided:

Installation

  1. Make sure you have the most recent version of R
  2. Run the following code in your R console
install.packages("MortalityLaws")

Updating to the latest version of the package

You can track and contribute to the development of MortalityLaws on GitHub. To install it:

  1. Install the release version of devtools from CRAN with install.packages("devtools").

  2. Make sure you have a working development environment.

    • Windows: Install Rtools.
    • Mac: Install Xcode from the Mac App Store.
    • Linux: Install a compiler and various development libraries (details vary across different flavors of Linux).
  3. Install the development version of MortalityLaws.

    devtools::install_github("mpascariu/MortalityLaws")

Help

All functions are documented in the standard way, which means that once you load the package using library(MortalityLaws) you can just type ?MortalityLaw to see the help file.

Copy Link

Version

Install

install.packages('MortalityLaws')

Monthly Downloads

716

Version

2.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Marius Pascariu

Last Published

January 15th, 2024

Functions in MortalityLaws (2.1.0)

JPNregions

region codes
LifeTable

Compute Life Tables from Mortality Data
ReadAHMD

Download the Australian Human Mortality Database (AHMD)
ReadCHMD

Download the Canadian Human Mortality Database (CHMD)
ReadJMD

Download the Japanese Mortality Database (JMD)
LifeTable.core

LifeTable.core
availableLF

Check Available Loss Function
availableLaws

Check Available Mortality Laws
MortalityLaws

MortalityLaws: Parametric Mortality Models, Life Tables and HMD
availableHMD

Check Data Availability in HMD
addDetails

Depending on the chosen mortality law, additional details need to be specified in order to be able to fit the models taking into account it's particularities.
check.MortalityLaw

Function to check input data in MortalityLaw
ReadHMD

Download The Human Mortality Database (HMD)
ahmd

MortalityLaws Test Data
ReadHMD.core

Function to Download Data for a one Country
beard_makeham

Makeham-Beard Model - 1971
bring_parameters

Bring or Rename Starting Parameters in the Law Functions
check_input_ReadAHMD

Check input ReadAHMD
ageMsg

What age(s) are we looking at?
beard

Beard Model - 1971
perks

Perks Model - 1932
check_input_ReadHMD

Check input ReadHMD
carriere1

Carriere Mortality Law - 1992
dx_lx

dx to lx
opperman

Opperman Mortality Law - 1870
check_input_ReadCHMD

Check input ReadHMD
convertFx

Convert Life Table Indicators
carriere2

Carriere Mortality Law - 1992
choose_optim

Select an optimizing method
print.availableLF

Print availableLF
deviance.MortalityLaw

deviance function for MortalityLaw
print.availableLaws

Print availableLaws
coale.demeny.ax

Find ax[1:2] indicators using Coale-Demeny coefficients Here we adjust the first two values of ax to account for infant mortality more accurately
check_input_ReadJMD

Check input ReadAHMD
find.my.case

Function that identifies the case/problem we have to solve
plot.MortalityLaw

Plot Function for MortalityLaw
predict.MortalityLaw

Predict function for MortalityLaw
invweibull

Inverse-Weibull Mortality Law
kannisto

Kannisto Mortality Law - 1998
data_format

Data formats
invgompertz

Inverse-Gompertz Mortality Law - informative parameterization
martinelle

Martinelle Model - 1987
vandermaen

Van der Maen Model - 1943
substrRight

Extracting the last n characters from a string
kannisto_makeham

Kannisto-Makeham Mortality Law - 1998
makeham0

Makeham Mortality Law - informative parameterization
df.residual.MortalityLaw

df.residual function for MortalityLaw
summary.MortalityLaw

Summary MortalityLaw
gompertz

Gompertz Mortality Law - 1825
ggompertz

Gamma-Gompertz Model as in Vaupel et al. (1979)
kostaki

Kostaki Model - 1992
vandermaen2

Van der Maen 2 Model - 1943
print.ReadAHMD

Print ReadCHMD
compute.ax

Find ax indicator
objective_fun

Function to be Optimize
gompertz0

Gompertz Mortality Law - informative parameterization
head_tail

Summary function - display head and tail in a single data.frame The original code for this function was first written for 'psych' R package here we have modified it a bit
quadratic

Quadratic Model
mx_qx

mx to qx
print.ReadCHMD

Print ReadCHMD
print.summary.MortalityLaw

Print summary.MortalityLaw
siler

Siler Mortality Law - 1979
logLik.MortalityLaw

logLik function for MortalityLaw
rogersplanck

Rogers-Planck Model - 1983
strehler_mildvan

Strehler-Mildvan Model - 1960
saveMsg

Print message when saving an object
print.ReadHMD

Print ReadHMD
make_http_request

Make HTTP request
makeham

Makeham Mortality Law - 1860
print.MortalityLaw

Print MortalityLaw
print.LifeTable

Print LifeTable
uxAbove100

Educate mx or qx on how to behave above age 100 if it gets in trouble (with NA's, zero's and Inf)
scale_x

Scaling method for x vector
saveOutput

Save Output in the working directory
print.ReadJMD

Print ReadJMD
wittstein

Wittstein Mortality Law - 1883
weibull

Weibull Mortality Law - 1939
thiele

Thiele Mortality Law - 1871
HMDcountries

Country codes
MortalityLaw

Fit Mortality Laws
LawTable

Compute Life Tables from Parameters of a Mortality Law
LifeTable.check

Check LifeTable input
HP4

Heligman-Pollard 4 Mortality Law - 9 parameters
JMD_sample

JMD sample Data object generated by the ReadJMD() function.
HMDindices

HMD Indices
AUSregions

region codes
AIC.MortalityLaw

AIC function for MortalityLaw
HP3

Heligman-Pollard 3 Mortality Law - 9 parameters
CANregions

Country codes
HP2

Heligman-Pollard 2 Mortality Law - 8 parameters
HMD_sample

HMD sample Data object generated by the ReadHMD() function.
AHMD_sample

AHMD sample Data object generated by the ReadAHMD() function.
HP

Heligman-Pollard Mortality Law - 8 parameters - 1980
CHMD_sample

CHMD sample Data object generated by the ReadCHMD() function.