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

setModificationR Documentation

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

Description

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

Usage

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)

  • setModification(mortalityTable): Return the life table with the given modification set

Examples

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))



MortalityTables documentation built on Nov. 2, 2023, 5:52 p.m.