mT.switchover {MortalityTables} | R Documentation |
Switch over mortalities from one table to another at a given age
Description
This function modifies a mortalityTable
by switching moralities at a given
age to the mortalities of a second table.
Usage
mT.switchover(table, to, at, weights = NULL)
Arguments
table |
The |
to |
The secondary |
at |
The age at which to switch over to the secondary table (if |
weights |
(optional) transition weights for transitioning the probabilities from the primary to the secondary table (as a linear combination). |
Details
This function mT.switchover
modifies the given mortalityTable
and replaces the mortalities starting from a given age by the mortalities
of a second table. By default, the transition from the original table to the
secondary table is a simple 0/1-switch at the given age at
. This is done
internally by using weights= (age >= at)
.
By giving custom weights, one can also implement a smooth transition to the secondary table. The weights are used as simple factors of a linear combination of the two tables.
Examples
mortalityTables.load("Austria_Census")
mort.AT.switchover = mT.switchover(mort.AT.census.2011.male, mort.AT.census.2011.female, 60)
plotMortalityTables(mort.AT.census.2011.male,
mT.setName(mort.AT.switchover, "Switched to female at age 60"))
# A smooth switchover is possible with custom weights
mort.AT.switchover.smooth = mT.switchover(mort.AT.census.2011.male, mort.AT.census.2011.female,
weights = c(rep(0, 55), 0:20/20, rep(1, 25)))
plotMortalityTables(mort.AT.census.2011.male,
mT.setName(mort.AT.switchover.smooth, "Switched to female smoothly at ages 55-75"))