diff --git a/R/InsuranceParameters.R b/R/InsuranceParameters.R index 9e93bbf9941ccc6ac2ffab25d8347e08f8c1bf19..883686b7e43fd81f6a8cb1b341f0e044e5ed60a1 100644 --- a/R/InsuranceParameters.R +++ b/R/InsuranceParameters.R @@ -119,6 +119,7 @@ InsuranceContract.ParameterDefaults = list( ActuarialBases = list( mortalityTable = NULL, invalidityTable = NULL, + invalidityEndsContract = FALSE, # Whether a claim for disease ends the contract or not i = 0.00, # guaranteed interest rate balanceSheetDate = as.Date("1900-12-31"), # Balance sheet date (for the calculation of the balance sheet reserves, year is irrelevant) balanceSheetMethod = "30/360", diff --git a/R/InsuranceTarif.R b/R/InsuranceTarif.R index ccd5fd7f6c3756a734727b6439215063481626a6..154467720493728fcf439cfbe38851249f6c56a3 100644 --- a/R/InsuranceTarif.R +++ b/R/InsuranceTarif.R @@ -106,8 +106,13 @@ InsuranceTarif = R6Class( i = rep(0, length(q)); } i = pad0(i, length(q)); - # TODO: Implement case where invalidity/disease does NOT end the contract! - df = data.frame(age = ages, q = q, i = i, p = 1 - q - i, row.names = ages - age) + # invalidity/disease does NOT end the contract if flag is set! + if (params$ActuarialBases$invalidityEndsContract) { + p = 1 - q - i + } else { + p = 1 - q + } + df = data.frame(age = ages, q = q, i = i, p = p, row.names = ages - age) df },