From 43eda0d527b8c9b0f7f3cecc4a1ff863f51389a6 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Wed, 22 Nov 2023 00:08:30 +0100
Subject: [PATCH] Add gammaInZillmer Parameter as a feature (i.e. gamma costs
 included in Zillmer premium, but not beta costs)

---
 R/InsuranceParameters.R                    | 3 +++
 R/InsuranceTarif.R                         | 3 +++
 man/InsuranceContract.ParameterDefaults.Rd | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/R/InsuranceParameters.R b/R/InsuranceParameters.R
index 691d603..05baf81 100644
--- a/R/InsuranceParameters.R
+++ b/R/InsuranceParameters.R
@@ -492,6 +492,8 @@ InsuranceContract.Values = list(
 #'               reserve) (default: TRUE)}
 #'     \item{\code{$betaGammaInZillmer}}{Whether beta and gamma-costs should be
 #'               included in the Zillmer premium calculation}
+#'     \item{\code{$gammaInZillmer}}{Whether gamma- (but not beta-) costs should be
+#'               included in the Zillmer premium calculation}
 #'     \item{\code{$alphaRefundLinear}}{Whether the refund of alpha-costs on
 #'               surrender is linear in t or follows the NPV of an annuity}
 #'     \item{\code{$useUnearnedPremiums}}{Whether unearned premiums should be
@@ -649,6 +651,7 @@ InsuranceContract.ParameterDefaults = list(
     Features = list(                            # Special cases for the calculations
         zillmering = TRUE,                      # Whether the contract uses Zillmering (and bases reserves on the Zillmer reserve as opposed to the adequate reserve)
         betaGammaInZillmer = FALSE,             # Whether beta and gamma-costs should be included in the Zillmer premium calculation
+        gammaInZillmer = FALSE,                 # Whether gamma- (but not beta-) costs should be included in the Zillmer premium calculation
         alphaRefundLinear  = TRUE,              # Whether the refund of alpha-costs on surrender is linear in t or follows the NPV of an annuity
         useUnearnedPremiums = isRegularPremiumContract, # Whether unearned premiums should be calculated in the balance sheet reserves. Otherwise, a premium paid at the beginning of the period is added to the reserve for balance-sheet purposes.
         surrenderIncludesCostsReserves = TRUE,  # Whether (administration) cost reserves are paid out on surrender (i.e. included in the surrender value before surrender penalties are applied)
diff --git a/R/InsuranceTarif.R b/R/InsuranceTarif.R
index bded4ea..6d55660 100644
--- a/R/InsuranceTarif.R
+++ b/R/InsuranceTarif.R
@@ -1018,6 +1018,9 @@ InsuranceTarif = R6Class(
         if (params$Features$betaGammaInZillmer) {
           affected = c(affected, "beta", "gamma")
         }
+        if (params$Features$gammaInZillmer) {
+          affected = c(affected, "gamma")
+        }
         coeff[["SumInsured"]][["costs"]][affected,"SumInsured",  ] = 1;
         coeff[["SumInsured"]][["costs"]][affected,"SumPremiums", ] = values$unitPremiumSum * premiums[["unit.gross"]];
         coeff[["SumInsured"]][["costs"]][affected,"GrossPremium",] = premiums[["unit.gross"]];
diff --git a/man/InsuranceContract.ParameterDefaults.Rd b/man/InsuranceContract.ParameterDefaults.Rd
index c8fe4b3..1d54d19 100644
--- a/man/InsuranceContract.ParameterDefaults.Rd
+++ b/man/InsuranceContract.ParameterDefaults.Rd
@@ -243,6 +243,8 @@ reserves on the Zillmer reserve as opposed to the adequate
 reserve) (default: TRUE)}
 \item{\code{$betaGammaInZillmer}}{Whether beta and gamma-costs should be
 included in the Zillmer premium calculation}
+\item{\code{$gammaInZillmer}}{Whether gamma- (but not beta-) costs should be
+included in the Zillmer premium calculation}
 \item{\code{$alphaRefundLinear}}{Whether the refund of alpha-costs on
 surrender is linear in t or follows the NPV of an annuity}
 \item{\code{$useUnearnedPremiums}}{Whether unearned premiums should be
-- 
GitLab