diff --git a/NAMESPACE b/NAMESPACE index 91ad374b6432fc7d0a5708e04c898441c4cb976e..953feff8b23ebc7272f8966a0ce82deec0646922 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -22,6 +22,7 @@ export(PP.base.meanContractualReserve) export(PP.base.previousContractualReserve) export(PP.base.sumInsured) export(PP.base.totalProfitAssignment) +export(PP.benefit.None) export(PP.benefit.Profit) export(PP.benefit.ProfitGuaranteeSupporting) export(PP.benefit.ProfitPlusGuaranteedInterest) diff --git a/R/ProfitParticipation_Functions.R b/R/ProfitParticipation_Functions.R index 492514efe08bc6253948f431363abb7ebc9a1d3f..942b3b5e4113376f2ed59de109548bb530089ebd 100644 --- a/R/ProfitParticipation_Functions.R +++ b/R/ProfitParticipation_Functions.R @@ -258,7 +258,7 @@ PP.calculate.RateOnBaseSGFFactor = function(base, rate, waiting, rates, params, sumProfits = function(profits, cols) { # extract the columns -- if they exist -- and sum them up: rowSums( - profits[, intersect(c(), colnames(profits))] + profits[, intersect(cols, colnames(profits)), drop = FALSE] ) } @@ -305,17 +305,17 @@ PP.benefit.ProfitPlusHalfGuaranteedInterest = function(profits, rates, ...) { }; #' @describeIn ProfitParticipationFunctions -#' Calculate accrued benefit as total profit with interest for one year (min of guarantee and total interest) +#' Calculate accrued benefit as total profit with interest for one year (max of guarantee and total interest) #' @export PP.benefit.ProfitPlusInterestMinGuaranteeTotal = function(profits, rates, ...) { - profits[,"regularBonus"] * (1 + pmin(rates$guaranteedInterest, rates$totalInterest)) + profits[,"regularBonus"] * (1 + pmax(rates$guaranteedInterest, rates$totalInterest)) }; #' @describeIn ProfitParticipationFunctions -#' Calculate accrued benefit as total profit with interest for half a year (min of guarantee and total interest) +#' Calculate accrued benefit as total profit with interest for half a year (max of guarantee and total interest) #' @export PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal = function(profits, rates, ...) { - profits[,"regularBonus"] * (1 + pmin(rates$guaranteedInterest, rates$totalInterest)/2) + profits[,"regularBonus"] * (1 + pmax(rates$guaranteedInterest, rates$totalInterest)/2) }; #' @describeIn ProfitParticipationFunctions @@ -348,4 +348,12 @@ PP.benefit.TerminalBonus = function(profits, params, ...) { sumProfits(profits, c("TBF", "terminalBonusReserve")) }; +#' @describeIn ProfitParticipationFunctions +#' No benefit paid out +#' @export +PP.benefit.None = function(profits, ...) { + 0 +}; + + "dummy" diff --git a/man/ProfitParticipationFunctions.Rd b/man/ProfitParticipationFunctions.Rd index 463246dbee555f2ab1e9695478ba6d6a20fe1735..810b4bd1330f285cd8de0c9850328603e902866a 100644 --- a/man/ProfitParticipationFunctions.Rd +++ b/man/ProfitParticipationFunctions.Rd @@ -40,6 +40,7 @@ \alias{PP.benefit.TerminalBonus5YearsProRata} \alias{PP.benefit.TerminalBonus5Years} \alias{PP.benefit.TerminalBonus} +\alias{PP.benefit.None} \title{Helper functions for profit participation} \usage{ PP.base.NULL(rates, params, values, ...) @@ -141,6 +142,8 @@ PP.benefit.TerminalBonus5YearsProRata(profits, params, ...) PP.benefit.TerminalBonus5Years(profits, params, ...) PP.benefit.TerminalBonus(profits, params, ...) + +PP.benefit.None(profits, ...) } \arguments{ \item{rates}{data.frame of profit rates} @@ -250,9 +253,9 @@ calculation function. \item \code{PP.benefit.ProfitPlusHalfGuaranteedInterest}: Calculate death benefit as total profit with (guaranteed) interest for one year -\item \code{PP.benefit.ProfitPlusInterestMinGuaranteeTotal}: Calculate accrued benefit as total profit with interest for one year (min of guarantee and total interest) +\item \code{PP.benefit.ProfitPlusInterestMinGuaranteeTotal}: Calculate accrued benefit as total profit with interest for one year (max of guarantee and total interest) -\item \code{PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal}: Calculate accrued benefit as total profit with interest for half a year (min of guarantee and total interest) +\item \code{PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal}: Calculate accrued benefit as total profit with interest for half a year (max of guarantee and total interest) \item \code{PP.benefit.ProfitGuaranteeSupporting}: Calculate accrued benefit as regular profit, but used to cover initial Zillmerization @@ -261,5 +264,7 @@ calculation function. \item \code{PP.benefit.TerminalBonus5Years}: Terminal bonus is only paid out during the last 5 years of the contract (but never during the first 10 years) \item \code{PP.benefit.TerminalBonus}: Calculate benefit from terminal bonus (full bonus), either old-style terminal bonus reserve or Terminal Bonus Fund (TBF) + +\item \code{PP.benefit.None}: No benefit paid out }}