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

891

Version

1.9.9

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Marius Pascariu

Last Published

February 22nd, 2023

Functions in MortalityLaws (1.9.9)

JPNregions

region codes
JMD_sample

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

Check LifeTable input
LifeTable.core

LifeTable.core
MortalityLaw

Fit Mortality Laws
HP3

Heligman-Pollard 3 Mortality Law - 9 parameters
HP4

Heligman-Pollard 4 Mortality Law - 9 parameters
MortalityLaws

MortalityLaws: Parametric Mortality Models, Life Tables and HMD
LawTable

Compute Life Tables from Parameters of a Mortality Law
LifeTable

Compute Life Tables from Mortality Data
availableLF

Check Available Loss Function
ReadCHMD

Download the Canadian Human Mortality Database (CHMD)
ReadHMD.core

Function to Download Data for a one Country
ReadHMD

Download The Human Mortality Database (HMD)
ReadJMD

Download the Japanese Mortality Database (JMD)
ReadAHMD

Download the Australian Human Mortality Database (AHMD)
availableHMD

Check Data Availability in HMD
check.MortalityLaw

Function to check input data in MortalityLaw
ageMsg

What age(s) are we looking at?
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.
ahmd

MortalityLaws Test Data
availableLaws

Check Available Mortality Laws
carriere1

Carriere Mortality Law - 1992
carriere2

Carriere Mortality Law - 1992
beard_makeham

Makeham-Beard Model - 1971
bring_parameters

Bring or Rename Starting Parameters in the Law Functions
check_input_ReadCHMD

Check input ReadHMD
check_input_ReadHMD

Check input ReadHMD
beard

Beard Model - 1971
df.residual.MortalityLaw

df.residual function for MortalityLaw
deviance.MortalityLaw

deviance function for MortalityLaw
dx_lx

dx to lx
find.my.case

Function that identifies the case/problem we have to solve
choose_optim

Select an optimizing method
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
check_input_ReadAHMD

Check input ReadAHMD
convertFx

Convert Life Table Indicators
invgompertz

Inverse-Gompertz Mortality Law - informative parameterization
objective_fun

Function to be Optimize
invweibull

Inverse-Weibull Mortality Law
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
gompertz0

Gompertz Mortality Law - informative parameterization
compute.ax

Find ax indicator
plot.MortalityLaw

Plot Function for MortalityLaw
kannisto

Kannisto Mortality Law - 1998
gompertz

Gompertz Mortality Law - 1825
kannisto_makeham

Kannisto-Makeham Mortality Law - 1998
opperman

Opperman Mortality Law - 1870
data_format

Data formats
perks

Perks Model - 1932
kostaki

Kostaki Model - 1992
logLik.MortalityLaw

logLik function for MortalityLaw
print.ReadCHMD

Print ReadCHMD
ggompertz

Gamma-Gompertz Model as in Vaupel et al. (1979)
print.summary.MortalityLaw

Print summary.MortalityLaw
rogersplanck

Rogers-Planck Model - 1983
quadratic

Quadratic Model
martinelle

Martinelle Model - 1987
mx_qx

mx to qx
print.ReadJMD

Print ReadJMD
print.availableHMD

Print for availableHMD
makeham

Makeham Mortality Law - 1860
makeham0

Makeham Mortality Law - informative parameterization
print.ReadAHMD

Print ReadCHMD
print.MortalityLaw

Print MortalityLaw
saveMsg

Print message when saving an object
predict.MortalityLaw

Predict function for MortalityLaw
print.ReadHMD

Print ReadHMD
substrRight

Extracting the last n characters from a string
wittstein

Wittstein Mortality Law - 1883
summary.MortalityLaw

Summary MortalityLaw
weibull

Weibull Mortality Law - 1939
print.LifeTable

Print LifeTable
print.availableLF

Print availableLF
scale_x

Scaling method for x vector
saveOutput

Save Output in the working directory
vandermaen2

Van der Maen 2 Model - 1943
vandermaen

Van der Maen Model - 1943
print.availableLaws

Print availableLaws
strehler_mildvan

Strehler-Mildvan Model - 1960
siler

Siler Mortality Law - 1979
thiele

Thiele Mortality Law - 1871
uxAbove100

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

Heligman-Pollard Mortality Law - 8 parameters - 1980
CHMD_sample

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

Country codes
HMDcountries

Country codes
AHMD_sample

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

HMD Indices
HMD_sample

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

AIC function for MortalityLaw
AUSregions

region codes
HP2

Heligman-Pollard 2 Mortality Law - 8 parameters