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

Clean up minor mistakes / typos; Improve test case generation (include code to...

Clean up minor mistakes / typos; Improve test case generation (include code to expoert sample contract to Excel)
parent 43eda0d5
No related branches found
No related tags found
No related merge requests found
# Version 1.0.1: XXXXXXXXXXX XX, 2023
* New parameters:
- survivalBenefit: Generalize survival benefit vectors (previously: unit CF 1 at end of contract)
- gammaInZillmer: As a feature, include gamma costs (but not beta) in the Zillmer premium
* Improve test case generation: Als generate code to export sample contract to Excel
# Version 1.0.0: October 27, 2023 # Version 1.0.0: October 27, 2023
* Renamed package from LifeInsuranceContracts to LifeInsureR * Renamed package from LifeInsuranceContracts to LifeInsureR
...@@ -462,7 +462,7 @@ InsuranceTarif = R6Class( ...@@ -462,7 +462,7 @@ InsuranceTarif = R6Class(
#' - For constant death benefit it will be rep(1, policyPeriod), #' - For constant death benefit it will be rep(1, policyPeriod),
#' - for linearly decreasing sum insured it will be (policyPeriod:0)/policyPeriod #' - for linearly decreasing sum insured it will be (policyPeriod:0)/policyPeriod
#' @details Not to be called directly, but implicitly by the [InsuranceContract] object. #' @details Not to be called directly, but implicitly by the [InsuranceContract] object.
#' @param len The desired length of the returned data frame (the number of contract periods desire) #' @param len The desired length of the returned data frame (the number of contract periods desired)
getDeathCF = function(len, params, values) { getDeathCF = function(len, params, values) {
if (getOption('LIC.debug.getDeathCF', FALSE)) { if (getOption('LIC.debug.getDeathCF', FALSE)) {
browser(); browser();
......
...@@ -172,7 +172,7 @@ makeContractGridDimnames = function(axes) { ...@@ -172,7 +172,7 @@ makeContractGridDimnames = function(axes) {
#' #'
#' @rdname contractGrid #' @rdname contractGrid
#' #'
#' @example #' @examples
#' library("MortalityTables") #' library("MortalityTables")
#' mortalityTables.load("Austria_Annuities_AVOe2005R") #' mortalityTables.load("Austria_Annuities_AVOe2005R")
#' # A trivial deferred annuity tariff with no costs, premiums during whole #' # A trivial deferred annuity tariff with no costs, premiums during whole
......
...@@ -354,7 +354,9 @@ vmGlgExample.generateTest = function(contract, prf = 10, t = 10, t_prf = 12, ... ...@@ -354,7 +354,9 @@ vmGlgExample.generateTest = function(contract, prf = 10, t = 10, t_prf = 12, ...
paste(names(arguments), arguments, sep = " = ", collapse = ",\n\t\t") paste(names(arguments), arguments, sep = " = ", collapse = ",\n\t\t")
); );
code = paste0(code, "\n\t);\n") code = paste0(code, "\n\t);\n")
code = paste0(code, "\t# showVmGlgExamples(contract, t = ", t, ", prf = ", prf, ", t_prf = ", t_prf, ");\n\n") code = paste0(code, "\t# showVmGlgExamples(contract, t = ", t, ", prf = ", prf, ", t_prf = ", t_prf, ");\n")
code = paste0(code, "\t# exportInsuranceContract.xlsx(contract, filename = here(\"", cntr, ".xlsx\"));\n")
code = paste0(code, "\t# openxlsx::openXL(here(\"", cntr, ".xlsx\"));\n\n")
code = paste0(code, "\ttestVmGlgExample(\n\t\tcontract, \n\t\tt = ", t, ", prf = ", prf, ", t_prf = ", t_prf, ",\n") code = paste0(code, "\ttestVmGlgExample(\n\t\tcontract, \n\t\tt = ", t, ", prf = ", prf, ", t_prf = ", t_prf, ",\n")
check.keys = c("net", "Zillmer", "gross", "written", "savings", "risk", check.keys = c("net", "Zillmer", "gross", "written", "savings", "risk",
......
...@@ -99,4 +99,24 @@ contractGrid( ...@@ -99,4 +99,24 @@ contractGrid(
contractClosing = as.Date("2023-11-01") contractClosing = as.Date("2023-11-01")
) )
library("MortalityTables")
mortalityTables.load("Austria_Annuities_AVOe2005R")
# A trivial deferred annuity tariff with no costs, premiums during whole
# deferral period, 30 years annuity payments:
tariff = InsuranceTarif$new(name="Test Annuity", type="annuity", tarif = "Annuity 1A",
mortalityTable = AVOe2005R.unisex, i=0.01,
deferralPeriod = function(params, ...) { params$ContractData$premiumPeriod },
policyPeriod = function(params, ...) { params$ContractData$premiumPeriod + 30 }
)
contractGridPremium(
axes = list(
age = seq(20, 60, 10),
premiumPeriod = seq(5,30, 5)
),
tarif = tariff,
sumInsured = 1000,
contractClosing = as.Date("2023-11-01")
)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment