From 3e6f4641148cc54a04bf16da4e09a5234e29fc7e Mon Sep 17 00:00:00 2001
From: Kainhofer Reinhold <reinhold.kainhofer@generali.com>
Date: Wed, 11 Mar 2020 19:33:04 +0100
Subject: [PATCH] Rename Profit participation functions

---
 NAMESPACE                           |  57 ++++-----
 R/ProfitParticipation.R             |  50 ++++----
 R/ProfitParticipation_Functions.R   |  73 +++++------
 man/ProfitParticipationFunctions.Rd | 184 ++++++++++++++--------------
 4 files changed, 183 insertions(+), 181 deletions(-)

diff --git a/NAMESPACE b/NAMESPACE
index 349c339..99f1e6f 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -13,6 +13,35 @@ export(InsuranceContract.ParametersFallback)
 export(InsuranceContract.ParametersFill)
 export(InsuranceContract.Values)
 export(InsuranceTarif)
+export(PP.base.NULL)
+export(PP.base.PreviousZillmerReserve)
+export(PP.base.ZillmerReserveT2)
+export(PP.base.ZillmerRiskPremium)
+export(PP.base.contractualReserve)
+export(PP.base.meanContractualReserve)
+export(PP.base.sumInsured)
+export(PP.benefit.Profit)
+export(PP.benefit.ProfitPlusGuaranteedInterest)
+export(PP.benefit.ProfitPlusHalfGuaranteedInterest)
+export(PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal)
+export(PP.benefit.ProfitPlusHalfTotalInterest)
+export(PP.benefit.ProfitPlusInterestMinGuaranteeTotal)
+export(PP.benefit.ProfitPlusTerminalBonusReserve)
+export(PP.benefit.ProfitPlusTotalInterest)
+export(PP.benefit.TerminalBonus5YearsProRata)
+export(PP.calculate.RateOnBase)
+export(PP.calculate.RateOnBaseSGFFactor)
+export(PP.calculate.RatePlusGuaranteeOnBase)
+export(PP.rate.expenseProfit)
+export(PP.rate.interestProfit)
+export(PP.rate.interestProfit2)
+export(PP.rate.interestProfitPlusGuarantee)
+export(PP.rate.riskProfit)
+export(PP.rate.sumProfit)
+export(PP.rate.terminalBonus)
+export(PP.rate.terminalBonusFundRatio)
+export(PP.rate.totalInterest)
+export(PP.rate.totalInterest2)
 export(ProfitParticipation)
 export(addDataTableWorksheet)
 export(applyHook)
@@ -32,34 +61,6 @@ export(makeContractGridDimname)
 export(makeContractGridDimnames)
 export(pad0)
 export(padLast)
-export(profPart.base.PreviousZillmerReserve)
-export(profPart.base.ZillmerReserveT2)
-export(profPart.base.ZillmerRiskPremium)
-export(profPart.base.contractualReserve)
-export(profPart.base.meanContractualReserve)
-export(profPart.base.sumInsured)
-export(profPart.benefit.Profit)
-export(profPart.benefit.ProfitPlusGuaranteedInterest)
-export(profPart.benefit.ProfitPlusHalfGuaranteedInterest)
-export(profPart.benefit.ProfitPlusHalfInterestMinGuaranteeTotal)
-export(profPart.benefit.ProfitPlusHalfTotalInterest)
-export(profPart.benefit.ProfitPlusInterestMinGuaranteeTotal)
-export(profPart.benefit.ProfitPlusTerminalBonusReserve)
-export(profPart.benefit.ProfitPlusTotalInterest)
-export(profPart.benefit.TerminalBonus5YearsProRata)
-export(profPart.calculate.RateOnBase)
-export(profPart.calculate.RateOnBaseSGFFactor)
-export(profPart.calculate.RatePlusGuaranteeOnBase)
-export(profPart.rate.expenseProfit)
-export(profPart.rate.interestProfit)
-export(profPart.rate.interestProfit2)
-export(profPart.rate.interestProfitPlusGuarantee)
-export(profPart.rate.riskProfit)
-export(profPart.rate.sumProfit)
-export(profPart.rate.terminalBonus)
-export(profPart.rate.terminalBonusFundRatio)
-export(profPart.rate.totalInterest)
-export(profPart.rate.totalInterest2)
 export(rollingmean)
 export(showVmGlgExamples)
 export(valueOrFunction)
diff --git a/R/ProfitParticipation.R b/R/ProfitParticipation.R
index f255baa..2347e33 100644
--- a/R/ProfitParticipation.R
+++ b/R/ProfitParticipation.R
@@ -31,32 +31,32 @@ ProfitParticipation = R6Class(
         # Calculation bases for the various types of profit
         # Can / shall be overridden in child classes that use other bases!
         #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-        getInterestProfitBase   = profPart.base.meanContractualReserve,
-        getRiskProfitBase       = profPart.base.ZillmerRiskPremium,
-        getExpenseProfitBase    = profPart.base.sumInsured,
-        getSumProfitBase        = profPart.base.sumInsured,
-
+        getInterestProfitBase   = PP.base.meanContractualReserve,
+        getRiskProfitBase       = PP.base.ZillmerRiskPremium,
+        getExpenseProfitBase    = PP.base.sumInsured,
+        getSumProfitBase        = PP.base.sumInsured,
+        getTerminalBonusBase    = PP.base.sumInsured,
+        
         #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         # Profit rates for the various types of profit
         # Can / shall be overridden in child classes that use other schemes!
         #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-        getInterestProfitRate   = profPart.rate.interestProfit,
-        getRiskProfitRate       = profPart.rate.riskProfit,
-        getExpenseProfitRate    = profPart.rate.expenseProfit,
-        getSumProfitRate        = profPart.rate.sumProfit,
-
-        getInterestOnProfits    = profPart.rate.totalInterest,
+        getInterestProfitRate   = PP.rate.interestProfit,
+        getRiskProfitRate       = PP.rate.riskProfit,
+        getExpenseProfitRate    = PP.rate.expenseProfit,
+        getSumProfitRate        = PP.rate.sumProfit,
+        getTerminalBonusRate    = PP.rate.terminalBonus,
+        
+        getInterestOnProfits    = PP.rate.totalInterest,
 
 
 
-        calculateInterestProfit = profPart.calculate.RateOnBase,
-        calculateRiskProfit     = profPart.calculate.RateOnBase,
-        calculateExpenseProfit  = profPart.calculate.RateOnBase,
-        calculateSumProfit      = profPart.calculate.RateOnBase,
+        calculateInterestProfit = PP.calculate.RateOnBase,
+        calculateRiskProfit     = PP.calculate.RateOnBase,
+        calculateExpenseProfit  = PP.calculate.RateOnBase,
+        calculateSumProfit      = PP.calculate.RateOnBase,
 
-        getTerminalBonusBase    = profPart.base.sumInsured,
-        getTerminalBonusRate    = profPart.rate.terminalBonus,
-        calculateTerminalBonus  = profPart.calculate.RateOnBase,
+        calculateTerminalBonus  = PP.calculate.RateOnBase,
         getTerminalBonusReserves = function(profits, rates, terminalBonus, terminalBonusAccount, params, values) {
             n = length(terminalBonusAccount)
             terminalBonusAccount * 1/(1.07) ^ ((n - 1):0)
@@ -68,13 +68,13 @@ ProfitParticipation = R6Class(
         # Can / shall be overridden in child classes that use other bases!
         #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-        calculateSurvivalBenefit      = profPart.benefit.ProfitPlusTerminalBonusReserve,
-        calculateDeathBenefitAccrued  = profPart.benefit.ProfitPlusGuaranteedInterest,
-        calculateDeathBenefitTerminal = profPart.benefit.TerminalBonus5YearsProRata,
-        calculateSurrenderBenefitAccrued = profPart.benefit.ProfitPlusHalfGuaranteedInterest,
-        calculateSurrenderBenefitTerminal = profPart.benefit.TerminalBonus5YearsProRata,
-        calculatePremiumWaiverBenefitAccrued = profPart.benefit.Profit,
-        calculatePremiumWaiverBenefitTerminal = profPart.benefit.TerminalBonus5YearsProRata,
+        calculateSurvivalBenefit      = PP.benefit.ProfitPlusTerminalBonusReserve,
+        calculateDeathBenefitAccrued  = PP.benefit.ProfitPlusGuaranteedInterest,
+        calculateDeathBenefitTerminal = PP.benefit.TerminalBonus5YearsProRata,
+        calculateSurrenderBenefitAccrued = PP.benefit.ProfitPlusHalfGuaranteedInterest,
+        calculateSurrenderBenefitTerminal = PP.benefit.TerminalBonus5YearsProRata,
+        calculatePremiumWaiverBenefitAccrued = PP.benefit.Profit,
+        calculatePremiumWaiverBenefitTerminal = PP.benefit.TerminalBonus5YearsProRata,
 
 
         dummy = 0
diff --git a/R/ProfitParticipation_Functions.R b/R/ProfitParticipation_Functions.R
index 5087f8a..39990d1 100644
--- a/R/ProfitParticipation_Functions.R
+++ b/R/ProfitParticipation_Functions.R
@@ -13,20 +13,21 @@ NULL
 NULL
 
 
-#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-#
-# Calculation bases for the various types of profit
-#
-#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+##########################################################################m##
+# Calculation bases for the various types of profit                      ####  
+##########################################################################m##
 
-#--------------------------------------------------------------------------
-# Calculation basis for Interest profit and profit on interest
-#--------------------------------------------------------------------------
+#' @describeIn ProfitParticipationFunctions
+#' Basis for profit: NONE (i.e. always returns 0)
+#' @export
+PP.base.NULL = function(rates, params, values, ...) {
+  rep(0, values$int$l)
+};
 
 #' @describeIn ProfitParticipationFunctions
 #' Basis for profit: Previous Zillmer reserve (no administration cost reserve)
 #' @export
-profPart.base.PreviousZillmerReserve = function(rates, params, values, ...) {
+PP.base.PreviousZillmerReserve = function(rates, params, values, ...) {
     nm = names(values$reserves[,"Zillmer"])
     res = c(0, head(values$reserves[,"Zillmer"], -1))
     names(res) = nm
@@ -36,7 +37,7 @@ profPart.base.PreviousZillmerReserve = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Basis for profit: Zillmer reserve (no administration cost reserve) at time t-2
 #' @export
-profPart.base.ZillmerReserveT2 = function(rates, params, values, ...) {
+PP.base.ZillmerReserveT2 = function(rates, params, values, ...) {
     nm = names(values$reserves[,"Zillmer"])
     res = c(0, 0, head(values$reserves[,"Zillmer"], -2))
     names(res) = nm
@@ -46,14 +47,14 @@ profPart.base.ZillmerReserveT2 = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Basis for profit: Contractual reserve (including administration costs) at time t
 #' @export
-profPart.base.contractualReserve = function(rates, params, values, ...) {
+PP.base.contractualReserve = function(rates, params, values, ...) {
     pmax(0, values$reserves[,"contractual"])
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Basis for profit: Contractual reserve (including administration costs) averaged over t and t-1
 #' @export
-profPart.base.meanContractualReserve = function(rates, params, values, ...) {
+PP.base.meanContractualReserve = function(rates, params, values, ...) {
     # Rolling mean of the value for the current and previous year.
     pmax(0, rollingmean(c(0, values$reserves[,"contractual"])))
 };
@@ -61,7 +62,7 @@ profPart.base.meanContractualReserve = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Basis for risk/mortality profit: Zillmer Risk Premium of the past year
 #' @export
-profPart.base.ZillmerRiskPremium = function(rates, params, values, ...) {
+PP.base.ZillmerRiskPremium = function(rates, params, values, ...) {
     # The risk premium of t=0 is used to determine the risk profit at time
     # t=1, so shift the whole vector!
     c(0, head(values$premiumComposition[,"Zillmer.risk"], -1))
@@ -70,7 +71,7 @@ profPart.base.ZillmerRiskPremium = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Basis for expense/sum profit: sum insured
 #' @export
-profPart.base.sumInsured = function(rates, params, values, ...) {
+PP.base.sumInsured = function(rates, params, values, ...) {
     params$ContractData$sumInsured
 };
 
@@ -84,41 +85,41 @@ profPart.base.sumInsured = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of interest profit rates (keyed by year)
 #' @export
-profPart.rate.interestProfit = function(rates, params, values, ...) {
+PP.rate.interestProfit = function(rates, params, values, ...) {
     rates$interestProfitRate
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of risk profit rates (keyed by year)
 #' @export
-profPart.rate.riskProfit = function(rates, params, values, ...) {
+PP.rate.riskProfit = function(rates, params, values, ...) {
     rates$mortalityProfitRate
 };
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of expense profit rates (keyed by year)
 #' @export
-profPart.rate.expenseProfit = function(rates, params, values, ...) {
+PP.rate.expenseProfit = function(rates, params, values, ...) {
     rates$expenseProfitRate
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of sum profit rates (keyed by year)
 #' @export
-profPart.rate.sumProfit = function(rates, params, values, ...) {
+PP.rate.sumProfit = function(rates, params, values, ...) {
     rates$sumProfitRate
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of terminal bonus rates (keyed by year)
 #' @export
-profPart.rate.terminalBonus = function(rates, params, values, ...) {
+PP.rate.terminalBonus = function(rates, params, values, ...) {
     rates$terminalBonusRate
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Returns the array of terminal bonus rates (keyed by year) as the terminal bonus fund ratio
 #' @export
-profPart.rate.terminalBonusFundRatio = function(rates, params, values, ...) {
+PP.rate.terminalBonusFundRatio = function(rates, params, values, ...) {
     rates$terminalBonusFundRatio
 };
 
@@ -126,28 +127,28 @@ profPart.rate.terminalBonusFundRatio = function(rates, params, values, ...) {
 #' @describeIn ProfitParticipationFunctions
 #' Rate for interest on past profits: total interest rate
 #' @export
-profPart.rate.interestProfitPlusGuarantee = function(rates, params, values, ...) {
+PP.rate.interestProfitPlusGuarantee = function(rates, params, values, ...) {
     rates$totalInterest + rates$guaranteedInterest
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Rate for interest on past profits: total interest rate
 #' @export
-profPart.rate.totalInterest = function(rates, params, values, ...) {
+PP.rate.totalInterest = function(rates, params, values, ...) {
     rates$totalInterest
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Rate for interest on past profits: second total interest rate
 #' @export
-profPart.rate.totalInterest2 = function(rates, params, values, ...) {
+PP.rate.totalInterest2 = function(rates, params, values, ...) {
     rates$totalInterest2
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Rate for interest on past profits: second interest profit rate (not including guaranteed interest), keyed by year
 #' @export
-profPart.rate.interestProfit2 = function(rates, params, values, ...) {
+PP.rate.interestProfit2 = function(rates, params, values, ...) {
     rates$interestProfitRate2
 };
 
@@ -168,21 +169,21 @@ getTerminalBonusReserves = function(profits, rates, terminalBonus, terminalBonus
 #' @describeIn ProfitParticipationFunctions
 #' Calculate profit by a simple rate applied on the basis (with an optional waiting vector of values 0 or 1)
 #' @export
-profPart.calculate.RateOnBase = function(base, rate, waiting, rates, params, values, ...) {
+PP.calculate.RateOnBase = function(base, rate, waiting, rates, params, values, ...) {
     base * rate * waiting
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate profit by a rate + guaranteed interest applied on the basis (with an optional waiting vector of values 0 or 1)
 #' @export
-profPart.calculate.RatePlusGuaranteeOnBase = function(base, rate, waiting, rates, params, values, ...) {
+PP.calculate.RatePlusGuaranteeOnBase = function(base, rate, waiting, rates, params, values, ...) {
     base * (rate + rates$guaranteedInterest) * waiting
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate profit by a simple rate applied on the basis (with only (1-SGFFactor) put into profit participation, and an optional waiting vector of values 0 or 1)
 #' @export
-profPart.calculate.RateOnBaseSGFFactor = function(base, rate, waiting, rates, params, values, ...) {
+PP.calculate.RateOnBaseSGFFactor = function(base, rate, waiting, rates, params, values, ...) {
     base * rate * waiting * (1 - rates$terminalBonusFundRatio)
 };
 
@@ -196,63 +197,63 @@ profPart.calculate.RateOnBaseSGFFactor = function(base, rate, waiting, rates, pa
 #' @describeIn ProfitParticipationFunctions
 #' Calculate survival benefit as total profit amount plus the terminal bonus reserve
 #' @export
-profPart.benefit.ProfitPlusTerminalBonusReserve = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusTerminalBonusReserve = function(profits, rates, params, values) {
     profits[,"totalProfit"] + profits[,"terminalBonusReserve"]
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate benefit as total profit accrued so far
 #' @export
-profPart.benefit.Profit = function(profits, rates, params, values) {
+PP.benefit.Profit = function(profits, rates, params, values) {
     profits[,"totalProfit"]
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate accrued death benefit as total profit with (guaranteed) interest for one year
 #' @export
-profPart.benefit.ProfitPlusGuaranteedInterest = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusGuaranteedInterest = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + rates$guaranteedInterest)
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate accrued death benefit as total profit with total interest (interest on profit rate) for one year
 #' @export
-profPart.benefit.ProfitPlusTotalInterest = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusTotalInterest = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + profits[,"interestOnProfitRate"])
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate accrued benefit as total profit with total interest (interest on profit rate) for half a year
 #' @export
-profPart.benefit.ProfitPlusHalfTotalInterest = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusHalfTotalInterest = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + profits[,"interestOnProfitRate"]/2)
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate death benefit as total profit with (guaranteed) interest for one year
 #' @export
-profPart.benefit.ProfitPlusHalfGuaranteedInterest = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusHalfGuaranteedInterest = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + rates$guaranteedInterest/2)
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate accrued benefit as total profit with interest for one year (min of guarantee and total interest)
 #' @export
-profPart.benefit.ProfitPlusInterestMinGuaranteeTotal = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusInterestMinGuaranteeTotal = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + pmin(rates$guaranteedInterest, rates$totalInterest))
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate accrued benefit as total profit with interest for half a year (min of guarantee and total interest)
 #' @export
-profPart.benefit.ProfitPlusHalfInterestMinGuaranteeTotal = function(profits, rates, params, values) {
+PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal = function(profits, rates, params, values) {
     profits[,"totalProfit"] * (1 + pmin(rates$guaranteedInterest, rates$totalInterest)/2)
 };
 
 #' @describeIn ProfitParticipationFunctions
 #' Calculate benefit from terminal bonus as 1/n parts of the terminal bonus reserve during the last 5 years
 #' @export
-profPart.benefit.TerminalBonus5YearsProRata = function(profits, rates, params, values) {
+PP.benefit.TerminalBonus5YearsProRata = function(profits, rates, params, values) {
     n = params$ContractData$policyPeriod;
     profits[, "terminalBonusReserve"] * (0:n)/n * ((0:n) >= max(10, n - 5))
 };
diff --git a/man/ProfitParticipationFunctions.Rd b/man/ProfitParticipationFunctions.Rd
index ad6178f..e8e1b57 100644
--- a/man/ProfitParticipationFunctions.Rd
+++ b/man/ProfitParticipationFunctions.Rd
@@ -2,100 +2,98 @@
 % Please edit documentation in R/ProfitParticipation_Functions.R
 \name{ProfitParticipationFunctions}
 \alias{ProfitParticipationFunctions}
-\alias{profPart.base.PreviousZillmerReserve}
-\alias{profPart.base.ZillmerReserveT2}
-\alias{profPart.base.contractualReserve}
-\alias{profPart.base.meanContractualReserve}
-\alias{profPart.base.ZillmerRiskPremium}
-\alias{profPart.base.sumInsured}
-\alias{profPart.rate.interestProfit}
-\alias{profPart.rate.riskProfit}
-\alias{profPart.rate.expenseProfit}
-\alias{profPart.rate.sumProfit}
-\alias{profPart.rate.terminalBonus}
-\alias{profPart.rate.terminalBonusFundRatio}
-\alias{profPart.rate.interestProfitPlusGuarantee}
-\alias{profPart.rate.totalInterest}
-\alias{profPart.rate.totalInterest2}
-\alias{profPart.rate.interestProfit2}
-\alias{profPart.calculate.RateOnBase}
-\alias{profPart.calculate.RatePlusGuaranteeOnBase}
-\alias{profPart.calculate.RateOnBaseSGFFactor}
-\alias{profPart.benefit.ProfitPlusTerminalBonusReserve}
-\alias{profPart.benefit.Profit}
-\alias{profPart.benefit.ProfitPlusGuaranteedInterest}
-\alias{profPart.benefit.ProfitPlusTotalInterest}
-\alias{profPart.benefit.ProfitPlusHalfTotalInterest}
-\alias{profPart.benefit.ProfitPlusHalfGuaranteedInterest}
-\alias{profPart.benefit.ProfitPlusInterestMinGuaranteeTotal}
-\alias{profPart.benefit.ProfitPlusHalfInterestMinGuaranteeTotal}
-\alias{profPart.benefit.TerminalBonus5YearsProRata}
+\alias{PP.base.NULL}
+\alias{PP.base.PreviousZillmerReserve}
+\alias{PP.base.ZillmerReserveT2}
+\alias{PP.base.contractualReserve}
+\alias{PP.base.meanContractualReserve}
+\alias{PP.base.ZillmerRiskPremium}
+\alias{PP.base.sumInsured}
+\alias{PP.rate.interestProfit}
+\alias{PP.rate.riskProfit}
+\alias{PP.rate.expenseProfit}
+\alias{PP.rate.sumProfit}
+\alias{PP.rate.terminalBonus}
+\alias{PP.rate.terminalBonusFundRatio}
+\alias{PP.rate.interestProfitPlusGuarantee}
+\alias{PP.rate.totalInterest}
+\alias{PP.rate.totalInterest2}
+\alias{PP.rate.interestProfit2}
+\alias{PP.calculate.RateOnBase}
+\alias{PP.calculate.RatePlusGuaranteeOnBase}
+\alias{PP.calculate.RateOnBaseSGFFactor}
+\alias{PP.benefit.ProfitPlusTerminalBonusReserve}
+\alias{PP.benefit.Profit}
+\alias{PP.benefit.ProfitPlusGuaranteedInterest}
+\alias{PP.benefit.ProfitPlusTotalInterest}
+\alias{PP.benefit.ProfitPlusHalfTotalInterest}
+\alias{PP.benefit.ProfitPlusHalfGuaranteedInterest}
+\alias{PP.benefit.ProfitPlusInterestMinGuaranteeTotal}
+\alias{PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal}
+\alias{PP.benefit.TerminalBonus5YearsProRata}
 \title{Helper functions for profit participation}
 \usage{
-profPart.base.PreviousZillmerReserve(rates, params, values, ...)
+PP.base.NULL(rates, params, values, ...)
 
-profPart.base.ZillmerReserveT2(rates, params, values, ...)
+PP.base.PreviousZillmerReserve(rates, params, values, ...)
 
-profPart.base.contractualReserve(rates, params, values, ...)
+PP.base.ZillmerReserveT2(rates, params, values, ...)
 
-profPart.base.meanContractualReserve(rates, params, values, ...)
+PP.base.contractualReserve(rates, params, values, ...)
 
-profPart.base.ZillmerRiskPremium(rates, params, values, ...)
+PP.base.meanContractualReserve(rates, params, values, ...)
 
-profPart.base.sumInsured(rates, params, values, ...)
+PP.base.ZillmerRiskPremium(rates, params, values, ...)
 
-profPart.rate.interestProfit(rates, params, values, ...)
+PP.base.sumInsured(rates, params, values, ...)
 
-profPart.rate.riskProfit(rates, params, values, ...)
+PP.rate.interestProfit(rates, params, values, ...)
 
-profPart.rate.expenseProfit(rates, params, values, ...)
+PP.rate.riskProfit(rates, params, values, ...)
 
-profPart.rate.sumProfit(rates, params, values, ...)
+PP.rate.expenseProfit(rates, params, values, ...)
 
-profPart.rate.terminalBonus(rates, params, values, ...)
+PP.rate.sumProfit(rates, params, values, ...)
 
-profPart.rate.terminalBonusFundRatio(rates, params, values, ...)
+PP.rate.terminalBonus(rates, params, values, ...)
 
-profPart.rate.interestProfitPlusGuarantee(rates, params, values, ...)
+PP.rate.terminalBonusFundRatio(rates, params, values, ...)
 
-profPart.rate.totalInterest(rates, params, values, ...)
+PP.rate.interestProfitPlusGuarantee(rates, params, values, ...)
 
-profPart.rate.totalInterest2(rates, params, values, ...)
+PP.rate.totalInterest(rates, params, values, ...)
 
-profPart.rate.interestProfit2(rates, params, values, ...)
+PP.rate.totalInterest2(rates, params, values, ...)
 
-profPart.calculate.RateOnBase(base, rate, waiting, rates, params, values,
-  ...)
+PP.rate.interestProfit2(rates, params, values, ...)
 
-profPart.calculate.RatePlusGuaranteeOnBase(base, rate, waiting, rates,
-  params, values, ...)
+PP.calculate.RateOnBase(base, rate, waiting, rates, params, values, ...)
 
-profPart.calculate.RateOnBaseSGFFactor(base, rate, waiting, rates, params,
+PP.calculate.RatePlusGuaranteeOnBase(base, rate, waiting, rates, params,
   values, ...)
 
-profPart.benefit.ProfitPlusTerminalBonusReserve(profits, rates, params,
-  values)
+PP.calculate.RateOnBaseSGFFactor(base, rate, waiting, rates, params,
+  values, ...)
 
-profPart.benefit.Profit(profits, rates, params, values)
+PP.benefit.ProfitPlusTerminalBonusReserve(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusGuaranteedInterest(profits, rates, params,
-  values)
+PP.benefit.Profit(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusTotalInterest(profits, rates, params, values)
+PP.benefit.ProfitPlusGuaranteedInterest(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusHalfTotalInterest(profits, rates, params,
-  values)
+PP.benefit.ProfitPlusTotalInterest(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusHalfGuaranteedInterest(profits, rates, params,
-  values)
+PP.benefit.ProfitPlusHalfTotalInterest(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusInterestMinGuaranteeTotal(profits, rates,
-  params, values)
+PP.benefit.ProfitPlusHalfGuaranteedInterest(profits, rates, params, values)
 
-profPart.benefit.ProfitPlusHalfInterestMinGuaranteeTotal(profits, rates,
-  params, values)
+PP.benefit.ProfitPlusInterestMinGuaranteeTotal(profits, rates, params,
+  values)
+
+PP.benefit.ProfitPlusHalfInterestMinGuaranteeTotal(profits, rates, params,
+  values)
 
-profPart.benefit.TerminalBonus5YearsProRata(profits, rates, params, values)
+PP.benefit.TerminalBonus5YearsProRata(profits, rates, params, values)
 }
 \description{
 Various helper functions for the \code{ProfitParticipation} class that
@@ -104,60 +102,62 @@ the rates and how the assigned profit is calculated.
 }
 \section{Functions}{
 \itemize{
-\item \code{profPart.base.PreviousZillmerReserve}: Basis for profit: Previous Zillmer reserve (no administration cost reserve)
+\item \code{PP.base.NULL}: Basis for profit: NONE (i.e. always returns 0)
+
+\item \code{PP.base.PreviousZillmerReserve}: Basis for profit: Previous Zillmer reserve (no administration cost reserve)
 
-\item \code{profPart.base.ZillmerReserveT2}: Basis for profit: Zillmer reserve (no administration cost reserve) at time t-2
+\item \code{PP.base.ZillmerReserveT2}: Basis for profit: Zillmer reserve (no administration cost reserve) at time t-2
 
-\item \code{profPart.base.contractualReserve}: Basis for profit: Contractual reserve (including administration costs) at time t
+\item \code{PP.base.contractualReserve}: Basis for profit: Contractual reserve (including administration costs) at time t
 
-\item \code{profPart.base.meanContractualReserve}: Basis for profit: Contractual reserve (including administration costs) averaged over t and t-1
+\item \code{PP.base.meanContractualReserve}: Basis for profit: Contractual reserve (including administration costs) averaged over t and t-1
 
-\item \code{profPart.base.ZillmerRiskPremium}: Basis for risk/mortality profit: Zillmer Risk Premium of the past year
+\item \code{PP.base.ZillmerRiskPremium}: Basis for risk/mortality profit: Zillmer Risk Premium of the past year
 
-\item \code{profPart.base.sumInsured}: Basis for expense/sum profit: sum insured
+\item \code{PP.base.sumInsured}: Basis for expense/sum profit: sum insured
 
-\item \code{profPart.rate.interestProfit}: Returns the array of interest profit rates (keyed by year)
+\item \code{PP.rate.interestProfit}: Returns the array of interest profit rates (keyed by year)
 
-\item \code{profPart.rate.riskProfit}: Returns the array of risk profit rates (keyed by year)
+\item \code{PP.rate.riskProfit}: Returns the array of risk profit rates (keyed by year)
 
-\item \code{profPart.rate.expenseProfit}: Returns the array of expense profit rates (keyed by year)
+\item \code{PP.rate.expenseProfit}: Returns the array of expense profit rates (keyed by year)
 
-\item \code{profPart.rate.sumProfit}: Returns the array of sum profit rates (keyed by year)
+\item \code{PP.rate.sumProfit}: Returns the array of sum profit rates (keyed by year)
 
-\item \code{profPart.rate.terminalBonus}: Returns the array of terminal bonus rates (keyed by year)
+\item \code{PP.rate.terminalBonus}: Returns the array of terminal bonus rates (keyed by year)
 
-\item \code{profPart.rate.terminalBonusFundRatio}: Returns the array of terminal bonus rates (keyed by year) as the terminal bonus fund ratio
+\item \code{PP.rate.terminalBonusFundRatio}: Returns the array of terminal bonus rates (keyed by year) as the terminal bonus fund ratio
 
-\item \code{profPart.rate.interestProfitPlusGuarantee}: Rate for interest on past profits: total interest rate
+\item \code{PP.rate.interestProfitPlusGuarantee}: Rate for interest on past profits: total interest rate
 
-\item \code{profPart.rate.totalInterest}: Rate for interest on past profits: total interest rate
+\item \code{PP.rate.totalInterest}: Rate for interest on past profits: total interest rate
 
-\item \code{profPart.rate.totalInterest2}: Rate for interest on past profits: second total interest rate
+\item \code{PP.rate.totalInterest2}: Rate for interest on past profits: second total interest rate
 
-\item \code{profPart.rate.interestProfit2}: Rate for interest on past profits: second interest profit rate (not including guaranteed interest), keyed by year
+\item \code{PP.rate.interestProfit2}: Rate for interest on past profits: second interest profit rate (not including guaranteed interest), keyed by year
 
-\item \code{profPart.calculate.RateOnBase}: Calculate profit by a simple rate applied on the basis (with an optional waiting vector of values 0 or 1)
+\item \code{PP.calculate.RateOnBase}: Calculate profit by a simple rate applied on the basis (with an optional waiting vector of values 0 or 1)
 
-\item \code{profPart.calculate.RatePlusGuaranteeOnBase}: Calculate profit by a rate + guaranteed interest applied on the basis (with an optional waiting vector of values 0 or 1)
+\item \code{PP.calculate.RatePlusGuaranteeOnBase}: Calculate profit by a rate + guaranteed interest applied on the basis (with an optional waiting vector of values 0 or 1)
 
-\item \code{profPart.calculate.RateOnBaseSGFFactor}: Calculate profit by a simple rate applied on the basis (with only (1-SGFFactor) put into profit participation, and an optional waiting vector of values 0 or 1)
+\item \code{PP.calculate.RateOnBaseSGFFactor}: Calculate profit by a simple rate applied on the basis (with only (1-SGFFactor) put into profit participation, and an optional waiting vector of values 0 or 1)
 
-\item \code{profPart.benefit.ProfitPlusTerminalBonusReserve}: Calculate survival benefit as total profit amount plus the terminal bonus reserve
+\item \code{PP.benefit.ProfitPlusTerminalBonusReserve}: Calculate survival benefit as total profit amount plus the terminal bonus reserve
 
-\item \code{profPart.benefit.Profit}: Calculate benefit as total profit accrued so far
+\item \code{PP.benefit.Profit}: Calculate benefit as total profit accrued so far
 
-\item \code{profPart.benefit.ProfitPlusGuaranteedInterest}: Calculate accrued death benefit as total profit with (guaranteed) interest for one year
+\item \code{PP.benefit.ProfitPlusGuaranteedInterest}: Calculate accrued death benefit as total profit with (guaranteed) interest for one year
 
-\item \code{profPart.benefit.ProfitPlusTotalInterest}: Calculate accrued death benefit as total profit with total interest (interest on profit rate) for one year
+\item \code{PP.benefit.ProfitPlusTotalInterest}: Calculate accrued death benefit as total profit with total interest (interest on profit rate) for one year
 
-\item \code{profPart.benefit.ProfitPlusHalfTotalInterest}: Calculate accrued benefit as total profit with total interest (interest on profit rate) for half a year
+\item \code{PP.benefit.ProfitPlusHalfTotalInterest}: Calculate accrued benefit as total profit with total interest (interest on profit rate) for half a year
 
-\item \code{profPart.benefit.ProfitPlusHalfGuaranteedInterest}: Calculate death benefit as total profit with (guaranteed) interest for one year
+\item \code{PP.benefit.ProfitPlusHalfGuaranteedInterest}: Calculate death benefit as total profit with (guaranteed) interest for one year
 
-\item \code{profPart.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 (min of guarantee and total interest)
 
-\item \code{profPart.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 (min of guarantee and total interest)
 
-\item \code{profPart.benefit.TerminalBonus5YearsProRata}: Calculate benefit from terminal bonus as 1/n parts of the terminal bonus reserve during the last 5 years
+\item \code{PP.benefit.TerminalBonus5YearsProRata}: Calculate benefit from terminal bonus as 1/n parts of the terminal bonus reserve during the last 5 years
 }}
 
-- 
GitLab