diff --git a/Auswertungen/2019-02-27_Bestimmung_Datum.xlsx b/Auswertungen/2019-02-27_Bestimmung_Datum.xlsx deleted file mode 100644 index 98f294c02b38517e8c41e5e81d06805aa4093286..0000000000000000000000000000000000000000 Binary files a/Auswertungen/2019-02-27_Bestimmung_Datum.xlsx and /dev/null differ diff --git a/R/InsuranceParameters.R b/R/InsuranceParameters.R index bdacecd10276b103bd95381bdb3d263e871e4635..337ff57040dc4383bc4370cf4aa17dc3ecf761a0 100644 --- a/R/InsuranceParameters.R +++ b/R/InsuranceParameters.R @@ -475,6 +475,9 @@ InsuranceContract.Values = list( #' ## Elements of sublist \code{InsuranceContract.ParameterDefault$Features} #' #' \describe{ +#' \item{\code{$zillmering}}{Whether the contract uses Zillmering (and bases +#' reserves on the Zillmer reserve as opposed to the adequate +#' reserve) (default: TRUE)} #' \item{\code{$betaGammaInZillmer}}{Whether beta and gamma-costs should be #' included in the Zillmer premium calculation} #' \item{\code{$alphaRefundLinear}}{Whether the refund of alpha-costs on @@ -548,6 +551,7 @@ InsuranceContract.Values = list( #' \item{\code{$adjustPresentValues}}{Adjust the present value vectors that are later used to derive premiums and reserves. \code{function(presentValues, params, values)}} #' \item{\code{$adjustPresentValuesCosts}}{Adjust the present value cost vectors used to derive premiums and reserves. \code{function(presentValuesCosts, params, values)}} #' \item{\code{$adjustPremiumCoefficients}}{Function with signature \code{function(coeff, type, premiums, params, values, premiumCalculationTime)} to adjust the coefficients for premium calculation after their default setup. Use cases are e.g. term-fix tariffs where the Zillmer premium term contains the administration cost over the whole contract, but not other gamma- or beta-costs.} +#' \item{\code{$adjustPremiums}}{Adjust the resulting premiums. \code{function(premiums = list(premiums, coefficients, sumInsured), params, values)}} #' \item{\code{$adjustPVForReserves}}{Adjust the absolute present value vectors used to derive reserves (e.g. when a sum rebate is subtracted from the gamma-cost reserves without influencing the premium calculation). \code{function(absPV, params, values)}} #' \item{\code{$premiumRebateCalculation}}{Calculate the actual premium rebate from the rebate rate (e.g. when the premium rate is given as a yearly cost reduction applied to a single-premium contract). \code{function(premiumRebateRate, params = params, values = values)}} #' } @@ -630,6 +634,7 @@ InsuranceContract.ParameterDefaults = list( commissionPeriod = 5 ), Features = list( # Special cases for the calculations + zillmering = TRUE, # Whether the contract uses Zillmering (and bases reserves on the Zillmer reserve as opposed to the adequate reserve) betaGammaInZillmer = FALSE, # Whether beta and gamma-costs should be included in the Zillmer premium calculation alphaRefundLinear = TRUE, # Whether the refund of alpha-costs on surrender is linear in t or follows the NPV of an annuity useUnearnedPremiums = isRegularPremiumContract, # Whether unearned premiums should be calculated in the balance sheet reserves. Otherwise, a premium paid at the beginning of the period is added to the reserve for balance-sheet purposes. @@ -669,10 +674,11 @@ InsuranceContract.ParameterDefaults = list( adjustCosts = NULL, adjustMinCosts = NULL, adjustPresentValues = NULL, # function(presentValues, params, values) - adjustPresentValuesCosts = NULL, # function(presentValuesCosts, params, values) + adjustPresentValuesCosts = NULL, # function(presentValuesCosts, params, values) adjustPremiumCoefficients = NULL, # function(coeff, type = type, premiums = premiums, params = params, values = values, premiumCalculationTime = premiumCalculationTime) + adjustPremiums = NULL, # function(premiums = list(premiums, coefficients, sumInsured), params, values) adjustPVForReserves = NULL, # function(absPresentValues, params, values) - premiumRebateCalculation = NULL # function(premiumRebateRate, params = params, values = values) + premiumRebateCalculation = NULL # function(premiumRebateRate, params = params, values = values) ) ); diff --git a/R/InsuranceTarif.R b/R/InsuranceTarif.R index 010c523f064cc2ca9fdbc1536a91eb7ff0f07b63..65858741d44c18ab98737fc47d7be9620031ed10 100644 --- a/R/InsuranceTarif.R +++ b/R/InsuranceTarif.R @@ -838,6 +838,7 @@ InsuranceTarif = R6Class( values$cashFlowsCosts[,,"SumPremiums",] * values$unitPremiumSum * values$premiums[["gross"]] + values$cashFlowsCosts[,,"GrossPremium",] * values$premiums[["gross"]] + values$cashFlowsCosts[,,"NetPremium",] * values$premiums[["net"]] + + # values$cashFlowsCosts[,,"Benefits",] * TODO!!! values$cashFlowsCosts[,,"Constant",]; # Handle survival CF differently, because we don't want ".survival" in the column names! @@ -975,6 +976,7 @@ InsuranceTarif = R6Class( affected = c(affected, "unitcosts") } coeff[["SumInsured"]][["costs"]][affected, "SumInsured", ] = 1; + coeff[["SumInsured"]][["costs"]][affected, "Benefits", ] = 1; # TODO: How to handle beta costs proportional to Sum Insured coeff[["Premium"]] [["costs"]][affected, "SumPremiums", ] = -values$unitPremiumSum; coeff[["Premium"]] [["costs"]][affected, "GrossPremium",] = -1; @@ -1230,7 +1232,11 @@ InsuranceTarif = R6Class( values$premiums[["tax"]] = premiumBeforeTax * tax; values$premiums[["written"]] = premiumBeforeTax * (1 + tax); - list("premiums" = values$premiums, "coefficients" = coefficients, "sumInsured" = params$ContractData$sumInsured) + applyHook( + params$Hooks$adjustPremiums, + list("premiums" = values$premiums, "coefficients" = coefficients, "sumInsured" = params$ContractData$sumInsured), + params = params, values = values + ) }, #' @description Calculate the reserves of the InsuranceContract given the @@ -1257,17 +1263,19 @@ InsuranceTarif = R6Class( resAdeq = absPV[,"benefitsAndRefund"] * securityFactor + absPV[,"alpha"] + absPV[,"beta"] + absPV[,"gamma"] - values$premiums[["gross"]] * absPV[,"premiums.unit"]; + if (params$Features$unitcostsInGross) { + resAdeq = resAdeq + absPV[, "unitcosts"] + } - #values$premiums[["Zillmer"]] * absPV[,"premiums"]; resGamma = absPV[,"gamma"] - ifelse(absPV[t, "premiums"] == 0, 0, absPV[t, "gamma"] / absPV[t, "premiums"]) * absPV[,"premiums"] + advanceProfitParticipation = 0; if (!is.null(ppScheme)) { advanceProfitParticipation = ppScheme$getAdvanceProfitParticipation(params = params, values = values) } - resConversion = (resZ + resGamma) * (1 - advanceProfitParticipation); # Alpha refund: Distribute alpha-costs to 5 years (or if shorter, the policy period), always starting at time 0: # If alphaRefunded==TRUE, don't refund a second time! @@ -1291,11 +1299,18 @@ InsuranceTarif = R6Class( } # Reduction Reserve: Reserve used for contract modifications: - resReduction = resZ + alphaRefund; + if (params$Features$zillmering) { + resContractual = resZ + resGamma + resReduction = resZ + alphaRefund; + } else { + resContractual = resAdeq + resGamma + resReduction = resAdeq + alphaRefund; + } + resConversion = resContractual * (1 - advanceProfitParticipation); if (params$Features$surrenderIncludesCostsReserves) { resReduction = resReduction + resGamma; } - resReduction = pmax(0,resReduction) # V_{x,n}^{Rkf} + resReduction = pmax(0, resReduction) # V_{x,n}^{Rkf} # Collect all reserves to one large matrix res = cbind( @@ -1304,7 +1319,7 @@ InsuranceTarif = R6Class( "Zillmer" = resZ, "adequate" = resAdeq, "gamma" = resGamma, - "contractual" = resZ + resGamma, + "contractual" = resContractual, "conversion" = resConversion, "alphaRefund" = alphaRefund, "reduction" = resReduction @@ -1406,7 +1421,12 @@ InsuranceTarif = R6Class( resN_BS = (1 - baf) * (reserves[,"net"] + if (!useUnearnedPremiums) values$premiumComposition[,"net"] else 0) + baf * c(reserves[-1, "net"], 0) resZ_BS = (1 - baf) * (reserves[,"Zillmer"] + if (!useUnearnedPremiums) values$premiumComposition[,"Zillmer"] else 0) + baf * c(reserves[-1, "Zillmer"], 0) resGamma_BS = (1 - baf) * (reserves[,"gamma"] + if (!useUnearnedPremiums) values$premiumComposition[,"gamma"] else 0) + baf * c(reserves[-1, "gamma"], 0) - res_BS = resZ_BS + resGamma_BS; + resGross_BS = (1 - baf) * (reserves[,"adequate"] + if (!useUnearnedPremiums) sum(values$premiumComposition[,c("alpha", "beta", "gamma")]) else 0) + baf * c(reserves[-1, "adequate"], 0) + if (params$Features$zillmering) { + res_BS = resZ_BS + resGamma_BS; + } else { + res_BS = resGross_BS; + } # Premium transfer / unearned premium: if (useUnearnedPremiums) { @@ -1438,6 +1458,7 @@ InsuranceTarif = R6Class( "net" = pmax(resN_BS,0), "Zillmer" = pmax(resZ_BS,0), "gamma" = pmax(resGamma_BS,0), + "gross" = pmax(resGross_BS,0), "Balance Sheet Reserve" = pmax(res_BS,0), "unearned Premiums" = unearnedPremiums ); diff --git a/man/InsuranceContract.ParameterDefaults.Rd b/man/InsuranceContract.ParameterDefaults.Rd index ac7bfb515100fa2cd99b637b9e6604c1cdc1d557..6f30bfcf9a2b0e4334a85e3fd7255955fd7d5e03 100644 --- a/man/InsuranceContract.ParameterDefaults.Rd +++ b/man/InsuranceContract.ParameterDefaults.Rd @@ -238,6 +238,9 @@ with duration "CommissionPeriod". Default is 5 years.} \subsection{Elements of sublist \code{InsuranceContract.ParameterDefault$Features}}{ \describe{ +\item{\code{$zillmering}}{Whether the contract uses Zillmering (and bases +reserves on the Zillmer reserve as opposed to the adequate +reserve) (default: TRUE)} \item{\code{$betaGammaInZillmer}}{Whether beta and gamma-costs should be included in the Zillmer premium calculation} \item{\code{$alphaRefundLinear}}{Whether the refund of alpha-costs on