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

Implement German Annuity Tables

parent 135ba22a
No related branches found
No related tags found
No related merge requests found
stopifnot(require(methods), require(utils), require(ValuationTables))
###############################################################################
# DAV 2004R exact (Male, Female)
###############################################################################
DAV2004R.data.basistafeln = utils::read.csv(
system.file("extdata",
"Germany_Annuities_DAV2004R.csv",
package = "ValuationTables"),
col.names = c("age",
"qxSel2Ord", "qySel2Ord", "qxAgg2Ord", "qyAgg2Ord",
"qxSelBestand", "qySelBestand", "qxAggBestand", "qyAggBestand",
"qxSel", "qySel", "qxAgg", "qyAgg"),
row.names = NULL,
skip = 3)
DAV2004R.data.trend = utils::read.csv(
system.file("extdata",
"Germany_Annuities_DAV2004R_Trends.csv",
package = "ValuationTables"),
col.names = c("age",
"trend2Ord.male.start", "trend2Ord.female.start",
"trend2Ord.male.end", "trend2Ord.female.end",
"trendBestand.male.start", "trendBestand.female.start",
"trendBestand.male.end", "trendBestand.female.end",
"trend1Ord.male", "trend1Ord.female"),
row.names = NULL,
skip = 3)
DAV2004R.data.select = utils::read.csv(
system.file("extdata",
"Germany_Annuities_DAV2004R_Select.csv",
package = "ValuationTables"),
col.names = c("year", "SelectMale", "SelectFemale"),
row.names = NULL,
skip = 2)
DAV2004R.data.av.grundtafeln = utils::read.csv(
system.file("extdata",
"Germany_Annuities_DAV2004R_AVBase.csv",
package = "ValuationTables"),
col.names = c("age",
"qxBestand", "qyBestand",
"qxB20", "qyB20",
"qx1Ord", "qy1Ord"),
row.names = NULL,
skip = 2)
DAV2004R.data.av = utils::read.csv(
system.file("extdata",
"Germany_Annuities_DAV2004R_AV.csv",
package = "ValuationTables"),
col.names = c("YOB", "shiftMBestand", "shiftFBestand",
"shiftMB20", "shiftFB20",
"shiftM1Ord", "shiftF1Ord"),
row.names = 1,
skip = 1)
# colnames(DAV2004R.data.basistafeln)
# colnames(DAV2004R.data.trend)
DAV2004R.male = valuationTable.trendProjection(
name = "DAV 2004R male, aggregate, loaded",
ages = DAV2004R.data.basistafeln$age,
baseYear = 1999,
deathProbs = DAV2004R.data.basistafeln$qxAgg,
trend = DAV2004R.data.trend$trend1Ord.male
);
DAV2004R.female = valuationTable.trendProjection(
name = "DAV 2004R female, aggregate, loaded",
ages = DAV2004R.data.basistafeln$age,
baseYear = 1999,
deathProbs = DAV2004R.data.basistafeln$qyAgg,
trend = DAV2004R.data.trend$trend1Ord.female
)
DAV2004R.male.2Ord = valuationTable.trendProjection(
name = "DAV 2004R male, aggregate, unloaded, no trend dampening",
ages = DAV2004R.data.basistafeln$age,
baseYear = 1999,
deathProbs = DAV2004R.data.basistafeln$qxAgg,
trend = DAV2004R.data.trend$trend2Ord.male.start
);
DAV2004R.female.2Ord = valuationTable.trendProjection(
name = "DAV 2004R female, aggregate, unloaded, no trend dampening",
ages = DAV2004R.data.basistafeln$age,
baseYear = 1999,
deathProbs = DAV2004R.data.basistafeln$qyAgg,
trend = DAV2004R.data.trend$trend2Ord.female.start
)
DAV2004R.male.av = valuationTable.ageShift(
name = "DAV 2004R male, age-shifted, aggregate, loaded",
ages = DAV2004R.data.av.grundtafeln$age,
deathProbs = DAV2004R.data.av.grundtafeln$qx1Ord,
ageShifts = DAV2004R.data.av["shiftM1Ord"]
);
DAV2004R.female.av = valuationTable.ageShift(
name = "DAV 2004R female, age-shifted, aggregate, loaded",
ages = DAV2004R.data.av.grundtafeln$age,
deathProbs = DAV2004R.data.av.grundtafeln$qy1Ord,
ageShifts = DAV2004R.data.av["shiftF1Ord"]
)
DAV2004R.male.av.2Ord = valuationTable.ageShift(
name = "DAV 2004R male, age-shifted, aggregate, unloaded, no trend dampening",
ages = DAV2004R.data.av.grundtafeln$age,
deathProbs = DAV2004R.data.av.grundtafeln$qxBestand,
ageShifts = DAV2004R.data.av["shiftMBestand"]
);
DAV2004R.female.av.2Ord = valuationTable.ageShift(
name = "DAV 2004R female, age-shifted, aggregate, unloaded, no trend dampening",
ages = DAV2004R.data.av.grundtafeln$age,
deathProbs = DAV2004R.data.av.grundtafeln$qyBestand,
ageShifts = DAV2004R.data.av["shiftFBestand"]
)
rm(DAV2004R.data.basistafeln,
DAV2004R.data.trend,
DAV2004R.data.select,
DAV2004R.data.av.grundtafeln,
DAV2004R.data.av)
......@@ -31,8 +31,7 @@ DAV2008T.data = utils::read.csv(
"", "", "", "",
"qy2", "qy2NR", "qy2R", # female 2nd order
"qy1", "qy1NR", "qy1R"), # female 1st order
skip = 1);
skip = 4);
### DAV 2008T Aggregat (smoker+non-smoker combined)
DAV2008T.male = valuationTable.period(
......@@ -100,3 +99,11 @@ DAV2008T.female.nonsmoker.2Ord = valuationTable.period(
deathProbs = DAV2008T.data$qy2NR)
rm(DAV2008T.data)
# plotValuationTables(DAV1994T.male, DAV2008T.male, DAV2008T.male.smoker, DAV2008T.male.nonsmoker, DAV2008T.male.2Ord, DAV2008T.male.smoker.2Ord, DAV2008T.male.nonsmoker.2Ord, legend.position = c(1, 0), title = "DAV 2008T Vergleich Raucher-Nichtraucher")
#
# plotValuationTables(DAV1994T.male, DAV2008T.male.2Ord, DAV2008T.male.smoker.2Ord, DAV2008T.male.nonsmoker.2Ord, legend.position = c(1, 0), title = "DAV 2008T Vergleich Raucher-Nichtraucher")
#
# plotValuationTableComparisons(DAV1994T.male, DAV2008T.male.2Ord, DAV2008T.male.smoker.2Ord, DAV2008T.male.nonsmoker.2Ord, legend.position = c(1, 0), title = "DAV 2008T Vergleich Raucher-Nichtraucher", reference = DAV2008T.male.2Ord, ylim=c(.5,2))
......@@ -3,6 +3,8 @@
\docType{methods}
\name{ages}
\alias{ages}
\alias{ages,valuationTable.joined-method}
\alias{ages,valuationTable.mixed-method}
\alias{ages,valuationTable.observed-method}
\alias{ages,valuationTable.period-method}
\title{Return the defined ages of the life table}
......@@ -11,6 +13,10 @@ ages(object, ...)
\S4method{ages}{valuationTable.period}(object, ...)
\S4method{ages}{valuationTable.mixed}(object, ...)
\S4method{ages}{valuationTable.joined}(object, ...)
\S4method{ages}{valuationTable.observed}(object, ...)
}
\arguments{
......@@ -23,8 +29,12 @@ Return the defined ages of the life table
}
\section{Methods (by class)}{
\itemize{
\item \code{valuationTable.period}: Return the defined ages of the life table
\item \code{valuationTable.period}: Return the defined ages of the period life table
\item \code{valuationTable.mixed}: Return the defined ages of the mixed life table
\item \code{valuationTable.joined}: Return the defined ages of the joined life table
\item \code{valuationTable.observed}: Return the defined ages of the life table
\item \code{valuationTable.observed}: Return the defined ages of the observed life table
}}
......@@ -5,7 +5,10 @@
\title{List all available sets of life tables provided by the \link[ValuationTables]{ValuationTables-package} package
An existing life table can then be loaded with \link{valuationTables.load}.}
\usage{
valuationTables.list()
valuationTables.list(pattern = "*")
}
\arguments{
\item{pattern}{Restrict the results only to life table sets that match the pattern (default: "*" to show all sets)}
}
\description{
List all available sets of life tables provided by the \link[ValuationTables]{ValuationTables-package} package
......
......@@ -4,10 +4,14 @@
\alias{valuationTables.load}
\title{Load a named set of life tables provided by the \link{ValuationTables} package}
\usage{
valuationTables.load(dataset)
valuationTables.load(dataset, wildcard = FALSE)
}
\arguments{
\item{dataset}{The set of life tables to be loaded. A list of all available data sets is provided by the}
\item{dataset}{The set of life tables to be loaded. A list of all available
data sets is provided by the}
\item{wildcard}{Whether the dataset name contains wildcard. If TRUE, all
datasets matching the pattern will be loaded}
}
\description{
Load a named set of life tables provided by the \link{ValuationTables} package
......
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment