setModification: Return a copy of the table with the given modification...

Description Usage Arguments Methods (by class) Examples

Description

Return a copy of the table with the given modification function added

Usage

1
2
3
4
setModification(object, modification = 0)

## S4 method for signature 'mortalityTable'
setModification(object, modification = 0)

Arguments

object

A life table object (instance of a mortalityTable class)

modification

The postprocessing modification function (for example, so enforce a lower bound).

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
mortalityTables.load("Austria_Census")
# Austrian census mortality 2011, with a lower floor of 0.1% death probability
at11.mod1perm = setModification(mort.AT.census.2011.male,
    modification = function(qx) {pmax(qx, 0.001)})
at11.mod1perm@name = paste(at11.mod1perm@name, "at least 0.1%")
# Austrian census mortality 2011, modified with 40% selection for ages
# below 60, vanishing linearly to age 80
at11.modSelection = setModification(mort.AT.census.2011.male,
    modification = function(qx) {
        qx * c(rep(0.6, 60), 0.6 + 0.4 * (0:20)/20, rep(1, length(qx)-81))
    })
at11.modSelection@name = paste(at11.modSelection@name, " 40% selection below 60")

plot(mort.AT.census.2011.male, at11.mod1perm, at11.modSelection,
    title = "Austrian census mortality with modifications", legend.position = c(0.99, 0.01))

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