Description Usage Arguments Value References Examples
View source: R/fun_LinearLink.R
Calibrate the Linear-Link mortality model introduced in \insertCitepascariu2020;textualMortalityEstimate.
1 2 3 4 5 6 7 8 9 | LinearLink(
x,
mx,
y,
country = "...",
theta = 0,
use.smooth = TRUE,
method = "LSE"
)
|
x |
Numerical vector containing ages corresponding to the input data (mx). |
mx |
Death rates matrix with age as row and time as column. |
y |
Vector of years corresponding to the mx matrix. |
country |
Optional. The name of the country that the data corresponds to. The name is adopted in the output tables. |
theta |
Age to be fitted. |
use.smooth |
Logical variable indicating whether the spline smoothing is applied or not to the estimated coefficients (bx and vx). The smoothing can be applied in order to avoid jumps in the mortality rates from one age to another. This using splines. One degree of freedom is allocated for every 5 year of age. |
method |
Optimizing method. Least squared approach |
A LinearLink
object containing:
input |
List with input objects provided in the function |
coefficients |
Estimated coefficient |
fitted.values |
Fitted values |
residuals |
Estimated deviance residuals |
fitted.life.tables |
Life tables constructed using the fitted values |
df_splines |
Degrees of freedom used in spline smoothing procedure |
model_info |
Description of the model |
process_date |
Data and time stamp |
Pascariu MD (2018). PhD Thesis: Modelling and Forecasting Mortality. University of Southern Denmark, 53-70. URL: https://github.com/mpascariu/PhD-Thesis/blob/master/Thesis.pdf.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Select the 1965 - 1990 time interval and fit the Linear-Link model
ages <- 0:100 # available ages in our datasets
years <- 1965:1990 # available years
sex <- 'female'
SWEmx <- HMD4mx$SWE[paste(ages), paste(years)]
# Fit the Linear-Link using the least square approach (LSE).
M <- LinearLink(x = ages,
mx = SWEmx,
y = years,
country = 'SWEDEN',
theta = 0,
method = 'LSE')
M
summary(M)
coef(M)
ls(M)
# Derive a mortality curve (life table) from a value of
# life expectancy at birth in 2014, say 84.05
e0 <- 84.05
LT1 <- LinearLinkLT(M, ex = e0)
LT2 <- LinearLinkLT(M, ex = e0, use.vx.rotation = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.