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

ProfitParticipation: Fix helper functions, add PP.benefit.none;

parent dcedd000
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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"
......@@ -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
}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment