mT.switchover: Switch over mortalities from one table to another at a given...

Description Usage Arguments Details Examples

View source: R/utilityFunctions.R

Description

This function modifies a mortalityTable by switching moralities at a given age to the mortalities of a second table.

Usage

1

Arguments

table

The mortalityTable to modify (transition the probabilities to the secondary table)

to

The secondary mortalityTable containing the target probabilities

at

The age at which to switch over to the secondary table (if weights are given, the at argument is ignored).

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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"))

kainhofer/r-mortality-tables documentation built on Dec. 17, 2020, 3:53 a.m.