From 8f2ea2ab558f1cb6da03f89aa88577fa64ac172d Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sun, 7 Nov 2021 19:39:43 +0100
Subject: [PATCH] Add flag to include (default) or exclude the administration
 cost reserve in the surrender value

Fixes #71
---
 R/InsuranceParameters.R                    | 6 +++++-
 R/InsuranceTarif.R                         | 6 +++++-
 man/InsuranceContract.ParameterDefaults.Rd | 3 +++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/R/InsuranceParameters.R b/R/InsuranceParameters.R
index 02291f0..06e5b13 100644
--- a/R/InsuranceParameters.R
+++ b/R/InsuranceParameters.R
@@ -443,6 +443,9 @@ InsuranceContract.Values = list(
 #'               immediately for balance-sheet purposes. In particular, the
 #'               balance sheet reserve at time $t=0$ is not 0, but the
 #'               premium paid. In turn, no unearned premiums are applied.}
+#'     \item{\code{$surrenderIncludesCostsReserves}}{Whether (administration)
+#'               cost reserves are paid out on surrender (i.e. included in the
+#'               surrender value before surrender penalties are applied)}
 #' }
 #'
 #' ## Elements of sublist \code{InsuranceContract.ParameterDefault$ProfitParticipation}
@@ -563,7 +566,8 @@ InsuranceContract.ParameterDefaults = list(
     Features = list(                            # Special cases for the calculations
         betaGammaInZillmer = FALSE,             # Whether beta and gamma-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.
+        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)
     ),
 
     ProfitParticipation = list(
diff --git a/R/InsuranceTarif.R b/R/InsuranceTarif.R
index 11b7c2b..3a0b6d4 100644
--- a/R/InsuranceTarif.R
+++ b/R/InsuranceTarif.R
@@ -1090,7 +1090,11 @@ InsuranceTarif = R6Class(
       }
 
       # Reduction Reserve: Reserve used for contract modifications:
-      resReduction = pmax(0, resZ + resGamma + alphaRefund) # V_{x,n}^{Rkf}
+      resReduction = resZ + alphaRefund;
+      if (params$Features$surrenderIncludesCostsReserves) {
+        resReduction = resReduction + resGamma;
+      }
+      resReduction = pmax(0,resReduction) # V_{x,n}^{Rkf}
 
       # Collect all reserves to one large matrix
       res = cbind(
diff --git a/man/InsuranceContract.ParameterDefaults.Rd b/man/InsuranceContract.ParameterDefaults.Rd
index 118bde8..f3c00be 100644
--- a/man/InsuranceContract.ParameterDefaults.Rd
+++ b/man/InsuranceContract.ParameterDefaults.Rd
@@ -241,6 +241,9 @@ premiums, but the initial single premium is added to the reserve
 immediately for balance-sheet purposes. In particular, the
 balance sheet reserve at time $t=0$ is not 0, but the
 premium paid. In turn, no unearned premiums are applied.}
+\item{\code{$surrenderIncludesCostsReserves}}{Whether (administration)
+cost reserves are paid out on surrender (i.e. included in the
+surrender value before surrender penalties are applied)}
 }
 }
 
-- 
GitLab