This package contains source code for the Double-Gap model for forecasting life expectancy in human populations.
Life expectancy is highly correlated over time among countries and between males and females. These associations can be used to improve forecasts. Here we have implemented a method for forecasting female life expectancy based on analysis of the gap between female life expectancy in a country compared with the record level of female life expectancy in the world. Second, to forecast male life expectancy, the gap between male life expectancy and female life expectancy in a country is analysed. We named this method the Double-Gap model. For a detailed description of the method see Pascariu et al. (2017).
install.packages("MortalityGaps")
You can track and contribute to the development of MortalityGaps
on GitHub. To install it:
Install the release version of devtools
from CRAN with install.packages("devtools")
.
Make sure you have a working development environment.
Xcode
from the Mac App Store.Install the development version of MortalityGaps
.
R
devtools::install_github("mpascariu/MortalityGaps")
All functions are documented in the standard way, which means that
once you load the package using library(MortalityGaps)
you can just type ?DoubleGap
to see the help file.
library(MortalityGaps)
# Collection of life expectancies for female populations exF <- MortalityGaps.data$exF # Life expectancy for male populations exM <- MortalityGaps.data$exM head(exF)
M0 <- DoubleGap(DF = exF, DM = exM, age = 0, country = "AUS", years = 1950:2014) M0
summary(M0)
P0 <- predict(M0, h = 36)
plot(P0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.