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

Allow both approaches for unit costs (as global parameter not included in CF...

Allow both approaches for unit costs (as global parameter not included in CF valuations, but can be function to use other premiums; as part of normal cost array, which cannot depend on other premiums etc.)
parent dceff562
No related branches found
No related tags found
No related merge requests found
...@@ -130,15 +130,10 @@ InsuranceContract = R6Class( ...@@ -130,15 +130,10 @@ InsuranceContract = R6Class(
params = self$Parameters, values = self$Values); params = self$Parameters, values = self$Values);
#### # #### #
# COSTS PARAMTERS: can be a function => evaluate it to get the real costs # COSTS PARAMETERS: can be a function => evaluate it to get the real costs
#### # #### #
self$Parameters$Costs = self$evaluateCosts(self$Parameters$Costs) self$Parameters$Costs = self$evaluateCosts(self$Parameters$Costs)
args = list(...);
if (!is.null(args$unitcosts)) {
warning("Defining unit costs with the unitcosts argument to InsuranceTarif or InsuranceContract is deprecated. Please set the unitcosts field of the general cost structure.")
self$Parameters$Costs[["unitcosts", "Constant", "PremiumPeriod"]] = args$unitcosts;
}
# browser();
#### # #### #
# AGES for multiple joint lives: # AGES for multiple joint lives:
#### # #### #
......
...@@ -12,7 +12,7 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam ...@@ -12,7 +12,7 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam
if (missing(costs)) { if (missing(costs)) {
dimnm = list( dimnm = list(
type = c("alpha", "Zillmer", "beta", "gamma", "gamma_nopremiums", "unitcosts"), type = c("alpha", "Zillmer", "beta", "gamma", "gamma_nopremiums", "unitcosts"),
basis = c("SumInsured", "SumPremiums", "GrossPremium", "NetPremium", "Constant"), basis = c("SumInsured", "SumPremiums", "GrossPremium", "NetPremium", "Constant", "Reserve"),
frequency = c("once", "PremiumPeriod", "PremiumFree", "PolicyPeriod") frequency = c("once", "PremiumPeriod", "PremiumFree", "PolicyPeriod")
); );
costs = array( costs = array(
...@@ -129,6 +129,7 @@ InsuranceContract.ParameterDefaults = list( ...@@ -129,6 +129,7 @@ InsuranceContract.ParameterDefaults = list(
Loadings = list( # Loadings can also be function(sumInsured, premiums) Loadings = list( # Loadings can also be function(sumInsured, premiums)
ongoingAlphaGrossPremium = 0, # Acquisition cost that increase the gross premium ongoingAlphaGrossPremium = 0, # Acquisition cost that increase the gross premium
tax = 0.04, # insurance tax, factor on each premium paid tax = 0.04, # insurance tax, factor on each premium paid
unitcosts = 0, # Annual unit cost for each policy (Stückkosten), absolute value (can be a function)
security = 0, # Additional security loading on all benefit payments, factor on all benefits security = 0, # Additional security loading on all benefit payments, factor on all benefits
noMedicalExam = 0, # Loading when no medicial exam is done, % of SumInsured noMedicalExam = 0, # Loading when no medicial exam is done, % of SumInsured
noMedicalExamRelative = 0, # Loading when no medicial exam is done, % of gross premium noMedicalExamRelative = 0, # Loading when no medicial exam is done, % of gross premium
......
...@@ -47,12 +47,6 @@ InsuranceTarif = R6Class( ...@@ -47,12 +47,6 @@ InsuranceTarif = R6Class(
# Fill all remaining uninitialized values with their defaults, except for profit participation params # Fill all remaining uninitialized values with their defaults, except for profit participation params
self$Parameters = InsuranceContract.ParametersFallback(self$Parameters, InsuranceContract.ParameterDefaults, ppParameters = FALSE); self$Parameters = InsuranceContract.ParametersFallback(self$Parameters, InsuranceContract.ParameterDefaults, ppParameters = FALSE);
args = list(...);
if (!is.null(args$unitcosts)) {
warning("Defining unit costs with the unitcosts argument to InsuranceTarif is deprecated. Please set the unitcosts field of the general cost structure.")
# self$Parameters$Costs[["unitcosts", "Constant", "PremiumPeriod"]] = args$unitcosts;
}
}, },
createModification = function(name = NULL, tarif = NULL, desc = NULL, tariffType = NULL, ...) { createModification = function(name = NULL, tarif = NULL, desc = NULL, tariffType = NULL, ...) {
...@@ -619,7 +613,7 @@ InsuranceTarif = R6Class( ...@@ -619,7 +613,7 @@ InsuranceTarif = R6Class(
values$presentValuesCosts["0","unitcosts","GrossPremium"] * values$premiums[["gross"]] + values$presentValuesCosts["0","unitcosts","GrossPremium"] * values$premiums[["gross"]] +
values$presentValuesCosts["0","unitcosts","NetPremium"] * values$premiums[["net"]] + values$presentValuesCosts["0","unitcosts","NetPremium"] * values$premiums[["net"]] +
values$presentValuesCosts["0","unitcosts","Constant"]; values$presentValuesCosts["0","unitcosts","Constant"];
premium.unitcosts = pv.unitcosts / values$presentValues[["0", "premiums"]]; premium.unitcosts = pv.unitcosts / values$presentValues[["0", "premiums"]] + valueOrFunction(loadings$unitcosts, params = params, values = values);
values$premiums[["unitcost"]] = premium.unitcosts; values$premiums[["unitcost"]] = premium.unitcosts;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment