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

Profit Participation: Allow schemes to specify which profit components they...

Profit Participation: Allow schemes to specify which profit components they provide. Remove all other components from the output (i.e. if a scheme does not have a terminal bonus, remove all terminal bonus-related columns from the profit participation dataframe)
parent 12e00c25
No related branches found
No related tags found
No related merge requests found
...@@ -128,6 +128,7 @@ InsuranceContract.ParameterDefaults = list( ...@@ -128,6 +128,7 @@ InsuranceContract.ParameterDefaults = list(
terminalBonusQuote = 0, terminalBonusQuote = 0,
profitParticipationScheme = NULL, # Gewinnbeteiligungssystem (object of class Profit Participation) profitParticipationScheme = NULL, # Gewinnbeteiligungssystem (object of class Profit Participation)
profitComponents = c("interest", "risk", "expense", "sum", "terminal"),
profitClass = NULL, profitClass = NULL,
profitRates = NULL # General, company-wide profit rates, key columns are year and profitClass profitRates = NULL # General, company-wide profit rates, key columns are year and profitClass
) )
......
...@@ -362,6 +362,32 @@ ProfitParticipation = R6Class( ...@@ -362,6 +362,32 @@ ProfitParticipation = R6Class(
premiumWaiver = premiumWaiverAccrued + premiumWaiverTerminalBonus premiumWaiver = premiumWaiverAccrued + premiumWaiverTerminalBonus
); );
# Clean the huge dataframe by removing columns that refer to profit
# sources that the current profit plan does not provide
toremove = c();
cnames = colnames(res)
if (!"interest" %in% params$ProfitParticipation$profitComponents) {
toremove = c(toremove, grep("^interest[BP]", cnames));
}
if (!"risk" %in% params$ProfitParticipation$profitComponents) {
toremove = c(toremove, grep("^risk", cnames));
}
if (!"expense" %in% params$ProfitParticipation$profitComponents) {
toremove = c(toremove, grep("^expense", cnames));
}
if (!"sum" %in% params$ProfitParticipation$profitComponents) {
toremove = c(toremove, grep("^sum", cnames));
}
if (!"terminal" %in% params$ProfitParticipation$profitComponents) {
toremove = c(toremove,
grep("^terminal", cnames),
grep("^.*TerminalBonus$", cnames)
);
}
if (length(toremove) > 0) {
res = res[,-toremove]
}
res res
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment