From 5cf1aea4b0a32a9c2c739ef1a9611a2ef42b1607 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Thu, 12 Jan 2023 21:54:02 +0100 Subject: [PATCH] Fix policy period for lifelong insurance contracts --- DESCRIPTION | 2 +- R/InsuranceTarif.R | 3 ++- man/InsuranceTarif.Rd | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4dbb540..7830ffa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,7 +35,7 @@ Imports: pander, tidyr License: GPL (>= 2) -RoxygenNote: 7.2.1 +RoxygenNote: 7.2.3 Collate: 'HelperFunctions.R' 'InsuranceParameters.R' diff --git a/R/InsuranceTarif.R b/R/InsuranceTarif.R index ab1cc1b..d8171ad 100644 --- a/R/InsuranceTarif.R +++ b/R/InsuranceTarif.R @@ -300,8 +300,9 @@ InsuranceTarif = R6Class( age = params$ContractData$technicalAge maxAge = MortalityTables::getOmega(params$ActuarialBases$mortalityTable) policyTerm = min(maxAge + 1 - age, params$ContractData$policyPeriod) + # Length of CF vectors / data.frames is always 1 more than the policy period, since there might be a survival payment at the end! list( - l = min(maxAge +1 - age, policyTerm), + l = policyTerm + 1, # Length of CF vectors (1 larger than policy period!) # maxAge is the last age with a given death probability, so it can be included in the policy term! # The policy must end AFTER that final year, not at the beginning! policyTerm = policyTerm, diff --git a/man/InsuranceTarif.Rd b/man/InsuranceTarif.Rd index 5e66aa6..624d5b3 100644 --- a/man/InsuranceTarif.Rd +++ b/man/InsuranceTarif.Rd @@ -1061,13 +1061,13 @@ All premiums, reserves and present values have already been calculated. \subsection{Method \code{calculateFutureSums()}}{ Generic function to calculate future sums of the values \subsection{Usage}{ -\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculateFutureSums(values, ...)}\if{html}{\out{</div>}} +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculateFutureSums(cf, ...)}\if{html}{\out{</div>}} } \subsection{Arguments}{ \if{html}{\out{<div class="arguments">}} \describe{ -\item{\code{values}}{The time series, for which future sums at all times are desired} +\item{\code{cf}}{The time series, for which future sums at all times are desired} \item{\code{...}}{currently unused} } @@ -1081,19 +1081,22 @@ Generic function to calculate future sums of the values Calculate all present values for a given time series. The mortalities are taken from the contract's parameters. \subsection{Usage}{ -\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculatePresentValues(values, params)}\if{html}{\out{</div>}} +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculatePresentValues(cf, params, values)}\if{html}{\out{</div>}} } \subsection{Arguments}{ \if{html}{\out{<div class="arguments">}} \describe{ -\item{\code{values}}{The time series, for which future present values at all +\item{\code{cf}}{The time series, for which future present values at all times are desired} \item{\code{params}}{Contract-specific, full set of parameters of the contract (merged parameters of the defaults, the tariff, the profit participation scheme and the contract)} +\item{\code{values}}{Contract values calculated so far (in the \code{contract$Values} +list) then this method is called by the contract object} + \item{\code{...}}{currently unused} } \if{html}{\out{</div>}} -- GitLab