Skip to content
Snippets Groups Projects
Commit 46d9a72f authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Rename the package to MortalityTables

Also rename the classes to mortalityTable.*
parent ca7edf91
No related branches found
No related tags found
No related merge requests found
Showing with 160 additions and 129 deletions
Package: ValuationTables Package: MortalityTables
Type: Package Type: Package
Version: 1.0 Version: 1.0
Date: 2016-05-01 Date: 2016-05-01
Title: A framework for various types of life tables Title: A framework for various types of mortality / life tables
Authors@R: c(person("Reinhold", "Kainhofer", role=c("aut", "cre"), email="reinhold@kainhofer.com")) Authors@R: c(person("Reinhold", "Kainhofer", role=c("aut", "cre"), email="reinhold@kainhofer.com"))
Author: Reinhold Kainhofer [aut, cre] Author: Reinhold Kainhofer [aut, cre]
Maintainer: Reinhold Kainhofer <reinhold@kainhofer.com> Maintainer: Reinhold Kainhofer <reinhold@kainhofer.com>
URL: https://gitlab.open-tools.net/R/r-valuation-tables URL: https://gitlab.open-tools.net/R/r-mortality-tables
Depends: Depends:
ggplot2, ggplot2,
methods, methods,
...@@ -24,31 +24,31 @@ Description: This package provides classes to implement cohort life tables ...@@ -24,31 +24,31 @@ Description: This package provides classes to implement cohort life tables
License: GPL (>= 2) License: GPL (>= 2)
RoxygenNote: 5.0.1 RoxygenNote: 5.0.1
Collate: Collate:
'valuationTable.R' 'mortalityTable.R'
'valuationTable.period.R' 'mortalityTable.period.R'
'valuationTable.ageShift.R' 'mortalityTable.ageShift.R'
'ageShift.R' 'ageShift.R'
'valuationTable.observed.R' 'mortalityTable.observed.R'
'valuationTable.joined.R' 'mortalityTable.joined.R'
'valuationTable.mixed.R' 'mortalityTable.mixed.R'
'ages.R' 'ages.R'
'baseTable.R' 'baseTable.R'
'baseYear.R' 'baseYear.R'
'valuationTable.improvementFactors.R' 'mortalityTable.improvementFactors.R'
'valuationTable.trendProjection.R' 'mortalityTable.trendProjection.R'
'deathProbabilities.R' 'deathProbabilities.R'
'getCohortTable.R' 'getCohortTable.R'
'getOmega.R' 'getOmega.R'
'getPeriodTable.R' 'getPeriodTable.R'
'lifeTable.R' 'lifeTable.R'
'makeQxDataFrame.R' 'makeQxDataFrame.R'
'mortalityTables.list.R'
'mortalityTables.load.R'
'periodDeathProbabilities.R' 'periodDeathProbabilities.R'
'plot.valuationTable.R' 'plot.mortalityTable.R'
'plotValuationTableComparisons.R' 'plotMortalityTableComparisons.R'
'plotValuationTables.R' 'plotMortalityTables.R'
'setLoading.R' 'setLoading.R'
'setModification.R' 'setModification.R'
'undampenTrend.R' 'undampenTrend.R'
'valuationTables.list.R'
'valuationTables.load.R'
VignetteBuilder: knitr VignetteBuilder: knitr
File moved
File moved
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
S3method(plot,valuationTable) S3method(plot,mortalityTable)
export(makeQxDataFrame) export(makeQxDataFrame)
export(plotValuationTableComparisons) export(mortalityTable)
export(plotValuationTables) export(mortalityTable.ageShift)
export(valuationTable) export(mortalityTable.improvementFactors)
export(valuationTable.ageShift) export(mortalityTable.joined)
export(valuationTable.improvementFactors) export(mortalityTable.mixed)
export(valuationTable.joined) export(mortalityTable.observed)
export(valuationTable.mixed) export(mortalityTable.period)
export(valuationTable.observed) export(mortalityTable.trendProjection)
export(valuationTable.period) export(mortalityTables.list)
export(valuationTable.trendProjection) export(mortalityTables.load)
export(valuationTables.list) export(plotMortalityTableComparisons)
export(valuationTables.load) export(plotMortalityTables)
exportClasses(valuationTable) exportClasses(mortalityTable)
exportClasses(valuationTable.ageShift) exportClasses(mortalityTable.ageShift)
exportClasses(valuationTable.improvementFactors) exportClasses(mortalityTable.improvementFactors)
exportClasses(valuationTable.joined) exportClasses(mortalityTable.joined)
exportClasses(valuationTable.mixed) exportClasses(mortalityTable.mixed)
exportClasses(valuationTable.observed) exportClasses(mortalityTable.observed)
exportClasses(valuationTable.period) exportClasses(mortalityTable.period)
exportClasses(valuationTable.trendProjection) exportClasses(mortalityTable.trendProjection)
exportMethods(ageShift) exportMethods(ageShift)
exportMethods(ages) exportMethods(ages)
exportMethods(baseTable) exportMethods(baseTable)
......
#' @include valuationTable.ageShift.R #' @include mortalityTable.ageShift.R
NULL NULL
#' Return the age shift of the age-shifted life table given the birth year #' Return the age shift of the age-shifted life table given the birth year
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
#' @param YOB The birth year for which the age shift should be determined. #' @param YOB The birth year for which the age shift should be determined.
#' #'
...@@ -13,7 +13,7 @@ setGeneric("ageShift", function(object, YOB=1975, ...) standardGeneric("ageShift ...@@ -13,7 +13,7 @@ setGeneric("ageShift", function(object, YOB=1975, ...) standardGeneric("ageShift
#' @describeIn ageShift Return the age shift of the age-shifted life table #' @describeIn ageShift Return the age shift of the age-shifted life table
#' given the birth year #' given the birth year
setMethod("ageShift", setMethod("ageShift",
"valuationTable.ageShift", "mortalityTable.ageShift",
function(object, YOB, ...) { function(object, YOB, ...) {
shift = object@ageShifts[toString(YOB),]; shift = object@ageShifts[toString(YOB),];
if (is.na(shift)) { if (is.na(shift)) {
......
#' @include valuationTable.period.R valuationTable.mixed.R valuationTable.joined.R valuationTable.observed.R #' @include mortalityTable.period.R mortalityTable.mixed.R mortalityTable.joined.R mortalityTable.observed.R
NULL NULL
#' Return the defined ages of the life table #' Return the defined ages of the life table
#' #'
#' @param object A life table object (instance of a \code{\linkS4class{valuationTable}} class) #' @param object A life table object (instance of a \code{\linkS4class{mortalityTable}} class)
#' @param ... Currently unused #' @param ... Currently unused
#' #'
#' @exportMethod ages #' @exportMethod ages
setGeneric("ages", function(object, ...) standardGeneric("ages")); setGeneric("ages", function(object, ...) standardGeneric("ages"));
#' @describeIn ages Return the defined ages of the period life table #' @describeIn ages Return the defined ages of the period life table
setMethod("ages", "valuationTable.period", setMethod("ages", "mortalityTable.period",
function (object, ...) { function (object, ...) {
object@ages; object@ages;
}) })
#' @describeIn ages Return the defined ages of the mixed life table #' @describeIn ages Return the defined ages of the mixed life table
setMethod("ages", "valuationTable.mixed", setMethod("ages", "mortalityTable.mixed",
function (object, ...) { function (object, ...) {
ages(object@table1); ages(object@table1);
}) })
#' @describeIn ages Return the defined ages of the joined life table #' @describeIn ages Return the defined ages of the joined life table
setMethod("ages", "valuationTable.joined", setMethod("ages", "mortalityTable.joined",
function (object, ...) { function (object, ...) {
ages(object@table1); ages(object@table1);
}) })
#' @describeIn ages Return the defined ages of the observed life table #' @describeIn ages Return the defined ages of the observed life table
setMethod("ages", "valuationTable.observed", setMethod("ages", "mortalityTable.observed",
function (object, ...) { function (object, ...) {
object@ages; object@ages;
}) })
......
#' @include valuationTable.R valuationTable.period.R #' @include mortalityTable.R mortalityTable.period.R
NULL NULL
#' Return the base table of the life table #' Return the base table of the life table
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
#' #'
#' @exportMethod baseTable #' @exportMethod baseTable
setGeneric("baseTable", function(object, ...) standardGeneric("baseTable")); setGeneric("baseTable", function(object, ...) standardGeneric("baseTable"));
#' @describeIn baseTable Return the base table of the life table #' @describeIn baseTable Return the base table of the life table
setMethod("baseTable", "valuationTable", setMethod("baseTable", "mortalityTable",
function (object, ...) { function (object, ...) {
c() c()
}) })
#' @describeIn baseTable Return the base table of the life table #' @describeIn baseTable Return the base table of the life table
setMethod("baseTable", "valuationTable.period", setMethod("baseTable", "mortalityTable.period",
function (object, ...) { function (object, ...) {
object@deathProbs object@deathProbs
}) })
#' @include valuationTable.R valuationTable.mixed.R #' @include mortalityTable.R mortalityTable.mixed.R
NULL NULL
#' Return the base year of the life table #' Return the base year of the life table
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
#' #'
#' @exportMethod baseYear #' @exportMethod baseYear
setGeneric("baseYear", function(object, ...) standardGeneric("baseYear")); setGeneric("baseYear", function(object, ...) standardGeneric("baseYear"));
#' @describeIn baseYear Return the base year of the life table #' @describeIn baseYear Return the base year of the life table
setMethod("baseYear", "valuationTable", setMethod("baseYear", "mortalityTable",
function (object, ...) { function (object, ...) {
object@baseYear object@baseYear
}) })
#' @describeIn baseYear Return the base year of the life table #' @describeIn baseYear Return the base year of the life table
setMethod("baseYear", "valuationTable.mixed", setMethod("baseYear", "mortalityTable.mixed",
function (object, ...) { function (object, ...) {
baseYear(object@table1) baseYear(object@table1)
}) })
#' @include valuationTable.R valuationTable.period.R valuationTable.ageShift.R valuationTable.trendProjection.R valuationTable.improvementFactors.R valuationTable.mixed.R #' @include mortalityTable.R mortalityTable.period.R mortalityTable.ageShift.R mortalityTable.trendProjection.R mortalityTable.improvementFactors.R mortalityTable.mixed.R
NULL NULL
#' Return the (cohort) death probabilities of the life table given the birth year (if needed) #' Return the (cohort) death probabilities of the life table given the birth year (if needed)
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
#' @param YOB The birth year for which the death probabilities should be calculated #' @param YOB The birth year for which the death probabilities should be calculated
#' #'
...@@ -12,14 +12,14 @@ setGeneric("deathProbabilities", function(object, ..., YOB = 1975) standardGener ...@@ -12,14 +12,14 @@ setGeneric("deathProbabilities", function(object, ..., YOB = 1975) standardGener
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the #' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed) #' life table given the birth year (if needed)
setMethod("deathProbabilities", "valuationTable.period", setMethod("deathProbabilities", "mortalityTable.period",
function(object, ..., YOB = 1975) { function(object, ..., YOB = 1975) {
object@modification(object@deathProbs * (1 + object@loading)); object@modification(object@deathProbs * (1 + object@loading));
}) })
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the #' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed) #' life table given the birth year (if needed)
setMethod("deathProbabilities","valuationTable.ageShift", setMethod("deathProbabilities","mortalityTable.ageShift",
function (object, ..., YOB = 1975) { function (object, ..., YOB = 1975) {
qx=object@deathProbs * (1 + object@loading); qx=object@deathProbs * (1 + object@loading);
shift = ageShift(object, YOB); shift = ageShift(object, YOB);
...@@ -33,7 +33,7 @@ setMethod("deathProbabilities","valuationTable.ageShift", ...@@ -33,7 +33,7 @@ setMethod("deathProbabilities","valuationTable.ageShift",
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the #' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed) #' life table given the birth year (if needed)
setMethod("deathProbabilities","valuationTable.trendProjection", setMethod("deathProbabilities","mortalityTable.trendProjection",
function (object, ..., YOB = 1975) { function (object, ..., YOB = 1975) {
qx=object@deathProbs * (1 + object@loading); qx=object@deathProbs * (1 + object@loading);
if (is.null(object@trend2) || length(object@trend2) <= 1) { if (is.null(object@trend2) || length(object@trend2) <= 1) {
...@@ -57,7 +57,7 @@ setMethod("deathProbabilities","valuationTable.trendProjection", ...@@ -57,7 +57,7 @@ setMethod("deathProbabilities","valuationTable.trendProjection",
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the #' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed) #' life table given the birth year (if needed)
setMethod("deathProbabilities","valuationTable.improvementFactors", setMethod("deathProbabilities","mortalityTable.improvementFactors",
function (object, ..., YOB = 1975) { function (object, ..., YOB = 1975) {
qx = object@deathProbs * (1 + object@loading); qx = object@deathProbs * (1 + object@loading);
finalqx = (1 - object@improvement)^(YOB + 0:(length(qx) - 1) - object@baseYear) * qx; finalqx = (1 - object@improvement)^(YOB + 0:(length(qx) - 1) - object@baseYear) * qx;
...@@ -66,7 +66,7 @@ setMethod("deathProbabilities","valuationTable.improvementFactors", ...@@ -66,7 +66,7 @@ setMethod("deathProbabilities","valuationTable.improvementFactors",
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the #' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed) #' life table given the birth year (if needed)
setMethod("deathProbabilities","valuationTable.mixed", setMethod("deathProbabilities","mortalityTable.mixed",
function (object, ..., YOB = 1975) { function (object, ..., YOB = 1975) {
qx1 = deathProbabilities(object@table1, ..., YOB) * (1 + object@loading); qx1 = deathProbabilities(object@table1, ..., YOB) * (1 + object@loading);
qx2 = deathProbabilities(object@table2, ..., YOB) * (1 + object@loading); qx2 = deathProbabilities(object@table2, ..., YOB) * (1 + object@loading);
......
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Return the cohort life table as a \code{valuationTable.period} object #' Return the cohort life table as a \code{mortalityTable.period} object
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param YOB The birth year for which the life table should be calculated #' @param YOB The birth year for which the life table should be calculated
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
#' #'
...@@ -11,10 +11,10 @@ NULL ...@@ -11,10 +11,10 @@ NULL
setGeneric("getCohortTable", function(object, YOB, ...) standardGeneric("getCohortTable")); setGeneric("getCohortTable", function(object, YOB, ...) standardGeneric("getCohortTable"));
#' @describeIn getCohortTable Return the cohort life table as a #' @describeIn getCohortTable Return the cohort life table as a
#' \code{valuationTable.period} object #' \code{mortalityTable.period} object
setMethod("getCohortTable","valuationTable", setMethod("getCohortTable","mortalityTable",
function (object, YOB, ...) { function (object, YOB, ...) {
valuationTable.period( mortalityTable.period(
name = paste(object@name, ", YOB ", YOB), name = paste(object@name, ", YOB ", YOB),
baseYear = YOB, baseYear = YOB,
ages = ages(object), ages = ages(object),
......
#' @include valuationTable.R valuationTable.period.R valuationTable.mixed.R valuationTable.joined.R valuationTable.observed.R #' @include mortalityTable.R mortalityTable.period.R mortalityTable.mixed.R mortalityTable.joined.R mortalityTable.observed.R
NULL NULL
#' Return the maximum age of the life table #' Return the maximum age of the life table
#' #'
#' @param object A life table object (instance of a \code{valuationTable} class) #' @param object A life table object (instance of a \code{mortalityTable} class)
#' #'
#' @exportMethod getOmega #' @exportMethod getOmega
setGeneric("getOmega", function(object) standardGeneric("getOmega")); setGeneric("getOmega", function(object) standardGeneric("getOmega"));
#' @describeIn getOmega Return the maximum age of the period life table #' @describeIn getOmega Return the maximum age of the period life table
setMethod("getOmega", "valuationTable.period", setMethod("getOmega", "mortalityTable.period",
function (object) { function (object) {
max(object@ages, na.rm = TRUE); max(object@ages, na.rm = TRUE);
}) })
#' @describeIn getOmega Return the maximum age of the mixed life table #' @describeIn getOmega Return the maximum age of the mixed life table
setMethod("getOmega", "valuationTable.mixed", setMethod("getOmega", "mortalityTable.mixed",
function (object) { function (object) {
getOmega(object@table1); getOmega(object@table1);
}) })
#' @describeIn getOmega Return the maximum age of the joined life table #' @describeIn getOmega Return the maximum age of the joined life table
setMethod("getOmega", "valuationTable.joined", setMethod("getOmega", "mortalityTable.joined",
function (object) { function (object) {
getOmega(object@table1); getOmega(object@table1);
}) })
#' @describeIn getOmega Return the maximum age of the joined life table #' @describeIn getOmega Return the maximum age of the joined life table
setMethod("getOmega", "valuationTable.observed", setMethod("getOmega", "mortalityTable.observed",
function (object) { function (object) {
max(object@ages, na.rm = TRUE); max(object@ages, na.rm = TRUE);
}) })
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Return the period life table as a \code{valuationTable.period} object #' Return the period life table as a \code{mortalityTable.period} object
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param Period The observation year, for which the death probabilities should #' @param Period The observation year, for which the death probabilities should
#' be determined #' be determined
#' @param ... Other parameters (currently unused) #' @param ... Other parameters (currently unused)
...@@ -15,10 +15,10 @@ setGeneric("getPeriodTable", ...@@ -15,10 +15,10 @@ setGeneric("getPeriodTable",
); );
#' @describeIn getPeriodTable Return the period life table as a #' @describeIn getPeriodTable Return the period life table as a
#' \code{valuationTable.period} object #' \code{mortalityTable.period} object
setMethod("getPeriodTable","valuationTable", setMethod("getPeriodTable","mortalityTable",
function (object, Period, ...) { function (object, Period, ...) {
valuationTable.period( mortalityTable.period(
name = paste(object@name, ", Period ", Period), name = paste(object@name, ", Period ", Period),
baseYear = Period, baseYear = Period,
ages = ages(object), ages = ages(object),
......
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Return the lifetable object (package lifecontingencies) for the cohort life table #' Return the lifetable object (package lifecontingencies) for the cohort life table
#' #'
#' @param object The life table object (class inherited from valuationTable) #' @param object The life table object (class inherited from mortalityTable)
#' @param ... Parameters to be passed to the \code{deathProbabilities} method #' @param ... Parameters to be passed to the \code{deathProbabilities} method
#' of the life table #' of the life table
#' #'
...@@ -12,7 +12,7 @@ setGeneric("lifeTable", function(object, ...) standardGeneric("lifeTable")); ...@@ -12,7 +12,7 @@ setGeneric("lifeTable", function(object, ...) standardGeneric("lifeTable"));
#' @describeIn lifeTable Return the lifetable object (package lifecontingencies) #' @describeIn lifeTable Return the lifetable object (package lifecontingencies)
#' for the cohort life table #' for the cohort life table
setMethod("lifeTable","valuationTable", setMethod("lifeTable","mortalityTable",
function (object, ...) { function (object, ...) {
qx = deathProbabilities(object, ...); qx = deathProbabilities(object, ...);
if (qx[[length(qx)]] != 1) { if (qx[[length(qx)]] != 1) {
......
#' Converts one or multiple life table objects to a data frame that can be #' Converts one or multiple mortality table objects to a data frame that can be
#' plotted by \code{plotValuationTables} or \code{plotValuationTableComparisons} #' plotted by \code{plotMortalityTables} or \code{plotMortalityTableComparisons}
#' #'
#' It is not required to call this function manually, \code{plotValuationTables} #' It is not required to call this function manually, \code{plotMortalityTables}
#' will automatically do it if object derived from class \code{valuationTable} #' will automatically do it if object derived from class \code{mortalityTable}
#' are passed. #' are passed.
#' #'
#' @param ... Life tables (objects of classes derived from \code{valuationTable}) #' @param ... Life tables (objects of classes derived from \code{mortalityTable})
#' @param YOB desired year of birth to be plotted as cohort life table (default: 1972) #' @param YOB desired year of birth to be plotted as cohort life table (default: 1972)
#' @param Period desired observation year to be plotted (default: NA). If both #' @param Period desired observation year to be plotted (default: NA). If both
#' \code{YOB} and \code{Period} are given, a period comparison is generated. #' \code{YOB} and \code{Period} are given, a period comparison is generated.
......
...@@ -6,24 +6,24 @@ ...@@ -6,24 +6,24 @@
"_PACKAGE" "_PACKAGE"
#' Class valuationTable #' Class mortalityTable
#' #'
#' Class \code{valuationTable} is the (virtual) base class for all valuation #' Class \code{mortalityTable} is the (virtual) base class for all mortality
#' tables. It contains the name and some general values applying to all #' tables. It contains the name and some general values applying to all
#' types of tables, but does not contain any data itself. Use a child class #' types of tables, but does not contain any data itself. Use a child class
#' to create actual valuation tables. #' to create actual mortality tables.
#' #'
#' @slot name The human-readable name of the valuation table #' @slot name The human-readable name of the mortality table
#' @slot baseYear The base year of the valuation table (e.g. for tables with trend projection) #' @slot baseYear The base year of the mortality table (e.g. for tables with trend projection)
#' @slot modification A function that will be called with the final death probabilities #' @slot modification A function that will be called with the final death probabilities
#' to give the user a way to modify the final probabilities #' to give the user a way to modify the final probabilities
#' @slot loading Additional security loading on the resulting table (single numeric #' @slot loading Additional security loading on the resulting table (single numeric
#' value, e.g. 0.05 adds 5\% security margin to the probabilities) #' value, e.g. 0.05 adds 5\% security margin to the probabilities)
#' #'
#' @export valuationTable #' @export mortalityTable
#' @exportClass valuationTable #' @exportClass mortalityTable
valuationTable=setClass( mortalityTable=setClass(
"valuationTable", "mortalityTable",
slots = list( slots = list(
name = "character", name = "character",
baseYear = "numeric", baseYear = "numeric",
...@@ -31,7 +31,7 @@ valuationTable=setClass( ...@@ -31,7 +31,7 @@ valuationTable=setClass(
modification = "function" modification = "function"
), ),
prototype = list( prototype = list(
name = "Actuarial Valuation Table", name = "Actuarial Mortality Table",
baseYear = 2000, baseYear = 2000,
loading = 0, loading = 0,
modification = identity modification = identity
......
#' @include valuationTable.R valuationTable.period.R #' @include mortalityTable.R mortalityTable.period.R
NULL NULL
#' Class valuationTable.ageShift - Cohort life tables generated by age-shift #' Class mortalityTable.ageShift - Cohort life tables generated by age-shift
#' #'
#' A cohort life table, obtained by age-shifting from a given base table (death probabilities #' A cohort life table, obtained by age-shifting from a given base table (death probabilities
# for a base birth year) # for a base birth year)
#' #'
#' @slot ageShifts A \code{data.frame} with columns \code{YOB} and \code{shifts} giving the age shifts for each birth year #' @slot ageShifts A \code{data.frame} with columns \code{YOB} and \code{shifts} giving the age shifts for each birth year
#' #'
#' @export valuationTable.ageShift #' @export mortalityTable.ageShift
#' @exportClass valuationTable.ageShift #' @exportClass mortalityTable.ageShift
valuationTable.ageShift = setClass( mortalityTable.ageShift = setClass(
"valuationTable.ageShift", "mortalityTable.ageShift",
slots = list( slots = list(
ageShifts = "data.frame" ageShifts = "data.frame"
), ),
prototype = list( prototype = list(
ageShifts = data.frame(YOB = c(), shifts = c()) ageShifts = data.frame(YOB = c(), shifts = c())
), ),
contains = "valuationTable.period" contains = "mortalityTable.period"
) )
#' @include valuationTable.R valuationTable.period.R #' @include mortalityTable.R mortalityTable.period.R
NULL NULL
#' Class valuationTable.improvementFactors - Cohort life table with improvement #' Class mortalityTable.improvementFactors - Cohort life table with improvement
#' factors #' factors
#' #'
#' A cohort life table, obtained by an improvment factor projection #' A cohort life table, obtained by an improvment factor projection
...@@ -11,10 +11,10 @@ NULL ...@@ -11,10 +11,10 @@ NULL
#' describes the death probabilities in this year) #' describes the death probabilities in this year)
#' @slot improvement Yearly improvement factors per age #' @slot improvement Yearly improvement factors per age
#' #'
#' @export valuationTable.improvementFactors #' @export mortalityTable.improvementFactors
#' @exportClass valuationTable.improvementFactors #' @exportClass mortalityTable.improvementFactors
valuationTable.improvementFactors = setClass( mortalityTable.improvementFactors = setClass(
"valuationTable.improvementFactors", "mortalityTable.improvementFactors",
slots = list( slots = list(
baseYear = "numeric", baseYear = "numeric",
improvement = "numeric" improvement = "numeric"
...@@ -23,5 +23,5 @@ valuationTable.improvementFactors = setClass( ...@@ -23,5 +23,5 @@ valuationTable.improvementFactors = setClass(
baseYear = 2012, baseYear = 2012,
improvement = rep(0,120) improvement = rep(0,120)
), ),
contains = "valuationTable.period" contains = "mortalityTable.period"
) )
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Class valuationTable.joined - Life table created by joining two life tables #' Class mortalityTable.joined - Life table created by joining two life tables
#' #'
#' A cohort life table obtained by joining two cohort life tables, each of which #' A cohort life table obtained by joining two cohort life tables, each of which
#' applies only to certain observation years (e.g. for the past use the observed #' applies only to certain observation years (e.g. for the past use the observed
#' PoDs, and project them to the future with the trend projection) #' PoDs, and project them to the future with the trend projection)
#' #'
#' @slot table1 The first \code{valuationTable}, valid for years given in \code{yearRange1} #' @slot table1 The first \code{mortalityTable}, valid for years given in \code{yearRange1}
#' @slot yearRange1 The years, for which \code{table1} describes the death probabilities #' @slot yearRange1 The years, for which \code{table1} describes the death probabilities
#' @slot table2 The second \code{valuationTable}, valid for years given in \code{yearRange2} #' @slot table2 The second \code{mortalityTable}, valid for years given in \code{yearRange2}
#' @slot yearRange2 The years, for which \code{table2} describes the death probabilities #' @slot yearRange2 The years, for which \code{table2} describes the death probabilities
#' #'
#' @export valuationTable.joined #' @export mortalityTable.joined
#' @exportClass valuationTable.joined #' @exportClass mortalityTable.joined
valuationTable.joined = setClass( mortalityTable.joined = setClass(
"valuationTable.joined", "mortalityTable.joined",
slots=list( slots=list(
table1 = "valuationTable", table1 = "mortalityTable",
yearRange1 = "numeric", yearRange1 = "numeric",
table2 = "valuationTable", table2 = "mortalityTable",
yearRange2 = "numeric" yearRange2 = "numeric"
), ),
contains = "valuationTable" contains = "mortalityTable"
) )
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Class valuationTable.mixed - Life table as a mix of two life tables #' Class mortalityTable.mixed - Life table as a mix of two life tables
#' #'
#' A cohort life table obtained by mixing two life tables with the given weights #' A cohort life table obtained by mixing two life tables with the given weights
#' #'
#' @slot table1 The first \code{valuationTable} #' @slot table1 The first \code{mortalityTable}
#' @slot table2 The second \code{valuationTable} #' @slot table2 The second \code{mortalityTable}
#' @slot weight1 The weight of the first valuation table #' @slot weight1 The weight of the first mortality table
#' @slot weight2 The weight of the second valuation table #' @slot weight2 The weight of the second mortality table
#' @slot loading Additional security loading #' @slot loading Additional security loading
#' #'
#' @export valuationTable.mixed #' @export mortalityTable.mixed
#' @exportClass valuationTable.mixed #' @exportClass mortalityTable.mixed
valuationTable.mixed = setClass( mortalityTable.mixed = setClass(
"valuationTable.mixed", "mortalityTable.mixed",
slots = c( slots = c(
table1 = "valuationTable", table1 = "mortalityTable",
table2 = "valuationTable", table2 = "mortalityTable",
weight1 = "numeric", weight1 = "numeric",
weight2 = "numeric", weight2 = "numeric",
loading = "numeric" loading = "numeric"
...@@ -27,5 +27,5 @@ valuationTable.mixed = setClass( ...@@ -27,5 +27,5 @@ valuationTable.mixed = setClass(
weight2 = 1/2, weight2 = 1/2,
loading = 0 loading = 0
), ),
contains = "valuationTable" contains = "mortalityTable"
) )
#' @include valuationTable.R #' @include mortalityTable.R
NULL NULL
#' Class valuationTable.observed - Life table from actual observations #' Class mortalityTable.observed - Life table from actual observations
#' #'
#' A cohort life table described by actual observations (data frame of PODs #' A cohort life table described by actual observations (data frame of PODs
#' per year and age) #' per year and age)
...@@ -10,10 +10,10 @@ NULL ...@@ -10,10 +10,10 @@ NULL
#' @slot years The observation years #' @slot years The observation years
#' @slot ages The observation ages #' @slot ages The observation ages
#' #'
#' @export valuationTable.observed #' @export mortalityTable.observed
#' @exportClass valuationTable.observed #' @exportClass mortalityTable.observed
valuationTable.observed = setClass( mortalityTable.observed = setClass(
"valuationTable.observed", "mortalityTable.observed",
slots = list( slots = list(
data = "data.frame", data = "data.frame",
years = "numeric", years = "numeric",
...@@ -24,5 +24,5 @@ valuationTable.observed = setClass( ...@@ -24,5 +24,5 @@ valuationTable.observed = setClass(
years = c(), years = c(),
ages = c() ages = c()
), ),
contains = "valuationTable" contains = "mortalityTable"
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment