From 69ea67e978ef3008ca55b1b9685cfd1002400ba0 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Wed, 12 Aug 2020 09:50:32 +0200 Subject: [PATCH] Fix building issues with package check - utf8 (umlaute) as escaped ASCII-codes - fix select warnings (variables seem not defined, due to non-standard evaluation) - Fix generics (different argument names...) - Vignette title --- DESCRIPTION | 9 +- NAMESPACE | 1 + R/contractGrid.R | 6 +- R/exportInsuranceContract_xlsx.R | 82 ++-- R/showVmGlgExamples.R | 30 +- man/InsuranceContract.ParameterDefaults.Rd | 4 +- man/InsuranceContract.ParameterStructure.Rd | 4 +- man/InsuranceContract.ParametersFallback.Rd | 3 +- man/InsuranceContract.ParametersFill.Rd | 8 +- man/InsuranceContract.Rd | 159 +++++++- man/InsuranceContract.Values.Rd | 4 +- man/InsuranceTarif.Rd | 354 +++++++++++++++++- man/ProfitParticipation.Rd | 140 ++++++- man/ProfitParticipationFunctions.Rd | 29 +- man/addDataTableWorksheet.Rd | 15 +- man/contractGrid.Rd | 8 +- man/exportInsuranceContractExample.Rd | 10 +- man/initializeCosts.Rd | 13 +- man/showVmGlgExamples.Rd | 3 +- ...ing-the-lifeinsurancecontracts-package.Rmd | 2 +- 20 files changed, 776 insertions(+), 108 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bca6808..2c19883 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: LifeInsuranceContracts Type: Package Version: 0.1 Date: 2016-05-07 -Title: A framework for general life insurance contracts, including profit - participation, contract changes etc. +Title: A framework for general, traditional life insurance contracts, including profit + participation and contract changes Description: R6 classes to model traditional life insurance contracts like annuities, whole life insurances or endowments. All relevant quantities like premium decomposition, reserves and benefits over the whole @@ -23,9 +23,10 @@ Imports: dplyr, scales, stringr, - methods + methods, + rlang License: GPL (>= 2) -RoxygenNote: 6.1.1 +RoxygenNote: 7.1.1 Collate: 'HelperFunctions.R' 'InsuranceParameters.R' diff --git a/NAMESPACE b/NAMESPACE index ca57ebf..53e4718 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -85,5 +85,6 @@ importFrom(lubridate,year) importFrom(lubridate,years) importFrom(methods,new) importFrom(objectProperties,setSingleEnum) +importFrom(rlang,.data) importFrom(utils,head) importFrom(utils,tail) diff --git a/R/contractGrid.R b/R/contractGrid.R index 2fc054e..1346e06 100644 --- a/R/contractGrid.R +++ b/R/contractGrid.R @@ -22,11 +22,11 @@ contractGrid = function(axes = list(age = seq(20, 60, 10), policyPeriod = seq(5, } #' @export -makeContractGridDimname.InsuranceTarif = function(tarif) { tarif$name } +makeContractGridDimname.InsuranceTarif = function(value) { value$name } #' @export -makeContractGridDimname.R6 = function(tarif) { tarif$name } +makeContractGridDimname.R6 = function(value) { value$name } #' @export -makeContractGridDimname.mortalityTable = function(table) { table@name } +makeContractGridDimname.mortalityTable = function(value) { value@name } #' @export makeContractGridDimname.numeric = function(value) { value } #' @export diff --git a/R/exportInsuranceContract_xlsx.R b/R/exportInsuranceContract_xlsx.R index 10f9fe7..3c6fe0c 100644 --- a/R/exportInsuranceContract_xlsx.R +++ b/R/exportInsuranceContract_xlsx.R @@ -62,8 +62,8 @@ writeValuesTable = function(wb, sheet, values, caption = NULL, crow = 1, ccol = writePremiumCoefficients = function(wb, sheet, values, tarif = NULL, type = "benefits", crow = crow, ccol = ccol) { writeData(wb, sheet, matrix(c( - "Nettoprämie", "", "Zillmerprämie", "", "Bruttoprämie", "", - "rel. zu VS", "rel. zu Prämie", "rel. zu VS", "rel. zu Prämie", "rel. zu VS", "rel. zu Prämie"), 6, 2 + "Nettopr\\u00e4mie", "", "Zillmerpr\\u00e4mie", "", "Bruttopr\\u00e4mie", "", + "rel. zu VS", "rel. zu Pr\\u00e4mie", "rel. zu VS", "rel. zu Pr\\u00e4mie", "rel. zu VS", "rel. zu Pr\\u00e4mie"), 6, 2 ), startCol = ccol, startRow = crow, colNames = FALSE, borders = "rows", borderColour = "gray5", borderStyle = "thin"); mergeCells(wb, sheet, cols = ccol, rows = crow:(crow + 1)); mergeCells(wb, sheet, cols = ccol, rows = (crow + 2):(crow + 3)); @@ -114,11 +114,11 @@ labelsReplace = function(labels) { labels[labels == "written_beforetax"] = "vor Steuer"; # Kosten - labels[labels == "alpha"] = intToUtf8(0x03B1); #"α"; + labels[labels == "alpha"] = "\u03b1"; labels[labels == "Zillmer"] = "Zill."; - labels[labels == "beta"] = intToUtf8(0x03B2);#"β"; - labels[labels == "gamma"] = intToUtf8(0x03B3); - labels[labels == "gamma_nopremiums"] = paste(intToUtf8(0x03B3), "prf."); + labels[labels == "beta"] = "\u03b2"; + labels[labels == "gamma"] = "\u03b3"; + labels[labels == "gamma_nopremiums"] = "\u03b3 prf."; labels[labels == "unitcosts"] = "StkK"; # Kosten-Basen @@ -129,15 +129,15 @@ labelsReplace = function(labels) { labels[labels == "Constant"] = ""; # Cash Flows - labels[labels == "premiums_advance"] = "Präm. vorsch."; - labels[labels == "premiums_arrears"] = "Präm. nachsch."; + labels[labels == "premiums_advance"] = "Pr\\u00e4m. vorsch."; + labels[labels == "premiums_arrears"] = "Pr\\u00e4m. nachsch."; labels[labels == "guaranteed_advance"] = "Gar. vorsch."; labels[labels == "guaranteed_arrears"] = "Gar. nachsch."; labels[labels == "survival_advance"] = "Erl. vorsch."; labels[labels == "survival_arrears"] = "Erl. nachsch."; # Barwerte - labels[labels == "premiums"] = "Präm."; + labels[labels == "premiums"] = "Pr\\u00e4m."; labels[labels == "guaranteed"] = "Gar."; labels[labels == "survival"] = "Erl."; labels[labels == "death_SumInsured"] = "Abl. VS"; @@ -156,43 +156,43 @@ labelsReplace = function(labels) { labels[labels == "PremiumFree"] = "Pr.Fr." labels[labels == "PolicyPeriod"] = "LZ" - # Rückstellungen + # R\\u00fcckstellungen labels[labels == "adequate"] = "ausr."; labels[labels == "contractual"] = "vertragl."; labels[labels == "conversion"] = "Umrechn."; - labels[labels == "alphaRefund"] = paste0(intToUtf8(0x03B1), "-Rücktrag"); # "α-Rücktrag"; - labels[labels == "reduction"] = "Sparpr.für DK"; + labels[labels == "alphaRefund"] = "\u03b1-R\\u00fccktrag"; + labels[labels == "reduction"] = "Sparpr.f\\u00fcr DK"; labels[labels == "PremiumsPaid"] = "Pr.Summe"; - labels[labels == "Surrender"] = "Rückkauf"; + labels[labels == "Surrender"] = "R\\u00fcckkauf"; labels[labels == "PremiumFreeSumInsured"] = "Prf.VS"; labels[labels == "Balance Sheet Reserve"] = "Bilanzreserve" - # Prämienzerlegung + # Pr\\u00e4mienzerlegung labels[labels == "charged"] = "verrechnet" labels[labels == "tax"] = "VSt." labels[labels == "loading.frequency"] = "UJZ" - labels[labels == "rebate.premium"] = "Präm.Rab." + labels[labels == "rebate.premium"] = "Pr\\u00e4m.Rab." labels[labels == "rebate.partner"] = "Partn.Rab." labels[labels == "unitcosts"] = "StkK" labels[labels == "profit.advance"] = "Vw.GB" labels[labels == "rebate.sum"] = "Summenrab." - labels[labels == "charge.noMedicalExam"] = "o.ärztl.U." + labels[labels == "charge.noMedicalExam"] = "o.\\u00e4rztl.U." labels[labels == "gross"] = "Brutto" - labels[labels == "alpha.noZillmer"] = paste0(intToUtf8(0x03B1), "(ungez.)");# "α(ungez.)"; - labels[labels == "alpha.Zillmer"] = paste0(intToUtf8(0x03B1), "(gezill.)"); # "α(gezill.)"; + labels[labels == "alpha.noZillmer"] = "\u03b1 (ungez.)"; + labels[labels == "alpha.Zillmer"] = "\u03b1 (gezill.)"; labels[labels == "net"] = "Netto"; labels[labels == "risk"] = "Risikopr."; labels[labels == "savings"] = "Sparpr."; labels[labels == "Zillmer.risk"] = "gez.Risikopr."; labels[labels == "Zillmer.savings"] = "gez.Sparpr."; labels[labels == "Zillmer.amortization"] = "gez.AK-Tilgung"; - labels[labels == "Zillmer.savings.real"] = "Sparpr.für DK"; + labels[labels == "Zillmer.savings.real"] = "Sparpr.f\\u00fcr DK"; # Vertragseigenschaften labels[labels == "InterestRate"] = "i"; labels[labels == "PolicyDuration"] = "LZ"; - labels[labels == "PremiumPayment"] = "Prämienzhlg."; - labels[labels == "Premiums"] = "Prämien"; + labels[labels == "PremiumPayment"] = "Pr\\u00e4mienzhlg."; + labels[labels == "Premiums"] = "Pr\\u00e4mien"; labels[labels == "age"] = "Alter"; labels[labels == "Sum insured"] = "Vers.summe"; labels[labels == "Mortality table"] = "Sterbetafel"; @@ -294,6 +294,7 @@ exportLoadingsTable = function(wb, sheet, contract, crow, ccol, styles = styles, +#' @importFrom rlang .data exportContractDataTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c()) { contractValues = getContractBlockValues(contract) contractPremiums = getContractBlockPremiums(contract) @@ -319,9 +320,9 @@ exportContractDataTable = function(wb, sheet, contract, ccol = 1, crow = 1, styl # Values (parameters, premiums, etc.) of all blocks #### tmp = contractValues %>% select( - Vertragsteil = ID, Tarif = Tariff, `Sum insured`, - `Mortality table`, i, Age, `Policy duration`, `Premium period`, - `Deferral period`, `Guaranteed payments`) + Vertragsteil = .data$ID, Tarif = .data$Tariff, .data$`Sum insured`, + .data$`Mortality table`, .data$i, .data$Age, .data$`Policy duration`, .data$`Premium period`, + .data$`Deferral period`, .data$`Guaranteed payments`) writeValuesTable(wb, sheet, values = setInsuranceValuesLabels(tmp), caption = "Basisdaten der Vertragsteile", crow = crow, ccol = 1, tableName = "BlocksBasicData", styles = styles) @@ -329,25 +330,25 @@ exportContractDataTable = function(wb, sheet, contract, ccol = 1, crow = 1, styl # Unit Premiums #### tmp = contractPremiums %>% - select(Vertragsteil = ID, unit.net, unit.Zillmer, unit.gross) + select(Vertragsteil = .data$ID, .data$unit.net, .data$unit.Zillmer, .data$unit.gross) writeValuesTable(wb, sheet, values = setInsuranceValuesLabels(tmp), - caption = "Prämiensätze (auf VS 1)", crow = crow, ccol = 1, + caption = "Pr\\u00e4miens\\u00e4tze (auf VS 1)", crow = crow, ccol = 1, tableName = "UnitPremiums", styles = styles, valueStyle = styles$unitpremiums) crow = crow + NROW(tmp) + 2 + 2 # 2 rows for caption/table header, 2 rows padding # Yearly Premiums #### tmp = contractPremiums %>% - select(Vertragsteil = ID, net, Zillmer, gross, written_yearly) + select(Vertragsteil = .data$ID, .data$net, .data$Zillmer, .data$gross, .data$written_yearly) writeValuesTable(wb, sheet, values = setInsuranceValuesLabels(tmp), - caption = "Jahresprämien", crow = crow, ccol = 1, + caption = "Jahrespr\\u00e4mien", crow = crow, ccol = 1, tableName = "YearlyPremiums", styles = styles, valueStyle = styles$currency0) crow = crow + NROW(tmp) + 2 + 2 # 2 rows for caption/table header, 2 rows padding # Written Premiums #### tmp = contractPremiums %>% - select(Vertragsteil = ID, written, unitcost, written_beforetax, tax) + select(Vertragsteil = .data$ID, .data$written, .data$unitcost, .data$written_beforetax, .data$tax) writeValuesTable(wb, sheet, values = setInsuranceValuesLabels(tmp), - caption = "Prämien (pro Zahlungsweise)", crow = crow, ccol = 1, + caption = "Pr\\u00e4mien (pro Zahlungsweise)", crow = crow, ccol = 1, tableName = "WrittenPremiums", styles = styles, valueStyle = styles$currency0) crow = crow + NROW(tmp) + 2 + 2 # 2 rows for caption/table header, 2 rows padding @@ -512,10 +513,10 @@ exportProfitParticipationTable = function(wb, sheet, contract, ccol = 1, crow = # Add table headers for the various sections: if (length(baseCols) > 0) { - writeTableCaption(wb, sheet, "Basisgrößen", rows = crow, cols = baseCols + ccol.table, style = styles$header); + writeTableCaption(wb, sheet, "Basisgr\\u00f6\\u00dfen", rows = crow, cols = baseCols + ccol.table, style = styles$header); } if (length(rateCols) > 0) { - writeTableCaption(wb, sheet, "Gewinnbeteiligungssätze", rows = crow, cols = rateCols + ccol.table, style = styles$header); + writeTableCaption(wb, sheet, "Gewinnbeteiligungss\\u00e4tze", rows = crow, cols = rateCols + ccol.table, style = styles$header); } if (length(profitCols) > 0) { writeTableCaption(wb, sheet, "GB Zuweisungen", rows = crow, cols = profitCols + ccol.table, style = styles$header); @@ -530,10 +531,11 @@ exportProfitParticipationTable = function(wb, sheet, contract, ccol = 1, crow = writeTableCaption(wb, sheet, "Todesfallleistung", rows = crow, cols = deathCols + ccol.table, style = styles$header); } if (length(surrenderCols) > 0) { - writeTableCaption(wb, sheet, "Rückkauf", rows = crow, cols = surrenderCols + ccol.table, style = styles$header); + + writeTableCaption(wb, sheet, "R\\u00fcckkauf", rows = crow, cols = surrenderCols + ccol.table, style = styles$header); } if (length(premiumWaiverCols) > 0) { - writeTableCaption(wb, sheet, "Prämienfreistellung", rows = crow, cols = premiumWaiverCols + ccol.table, style = styles$header); + writeTableCaption(wb, sheet, "Pr\\u00e4mienfreistellung", rows = crow, cols = premiumWaiverCols + ccol.table, style = styles$header); } exportBlockID(wb, sheet, id = id, rows = blockid.row, cols = ccol:cl, styles = styles) @@ -565,7 +567,7 @@ exportPremiumCompositionTable = function(wb, sheet, contract, ccol = 1, crow = 1 cl = cl + writeValuesTable( wb, sheet, as.data.frame(setInsuranceValuesLabels(contract$Values$premiumComposition)), crow = crow, ccol = cl, tableName = tableName("Premium_Decomposition_", id), styles = styles, - caption = "Prämienzerlegung", valueStyle = styles$currency0) + 1; + caption = "Pr\\u00e4mienzerlegung", valueStyle = styles$currency0) + 1; crow = crow + nrrow + 4; @@ -574,7 +576,7 @@ exportPremiumCompositionTable = function(wb, sheet, contract, ccol = 1, crow = 1 cl = cl + writeValuesTable( wb, sheet, as.data.frame(setInsuranceValuesLabels(contract$Values$premiumCompositionSums)), crow = crow, ccol = cl, tableName = tableName("Premium_DecompositionSums_", id), styles = styles, - caption = "Prämienzerlegung (Summe zukünftiger Prämien)", valueStyle = styles$currency0) + 1; + caption = "Pr\\u00e4mienzerlegung (Summe zuk\\u00fcnftiger Pr\\u00e4mien)", valueStyle = styles$currency0) + 1; crow = crow + nrrow + 4; @@ -583,7 +585,7 @@ exportPremiumCompositionTable = function(wb, sheet, contract, ccol = 1, crow = 1 cl = cl + writeValuesTable( wb, sheet, as.data.frame(setInsuranceValuesLabels(contract$Values$premiumCompositionPV)), crow = crow, ccol = cl, tableName = tableName("Premium_DecompositionPV_", id), styles = styles, - caption = "Prämienzerlegung(Barwerte zukünftiger Prämien)", valueStyle = styles$currency0) + 1; + caption = "Pr\\u00e4mienzerlegung(Barwerte zuk\\u00fcnftiger Pr\\u00e4mien)", valueStyle = styles$currency0) + 1; endrow = (crow + 1 + nrrow) @@ -701,7 +703,7 @@ exportPVTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c(), caption = "Kostenbarwerte", valueStyle = styles$cost0) + 1; # Now print out the formulas for premium calculation into the columns 2 and 3: - writeData(wb, sheet, as.data.frame(c("Nettoprämie", contract$Values$premiums[["net"]],"Zillmerprämie", contract$Values$premiums[["Zillmer"]], "Bruttoprämie", contract$Values$premiums[["gross"]])), startCol = ccol, startRow = crow, colNames = FALSE, borders = "rows"); + writeData(wb, sheet, as.data.frame(c("Nettopr\\u00e4mie", contract$Values$premiums[["net"]],"Zillmerpr\\u00e4mie", contract$Values$premiums[["Zillmer"]], "Bruttopr\\u00e4mie", contract$Values$premiums[["gross"]])), startCol = ccol, startRow = crow, colNames = FALSE, borders = "rows"); for (i in 0:5) { writeFormula(wb, sheet, paste0("SUMPRODUCT(", sprintf(area.premiumcoeff, crow + i, crow + i), ", ", area.premiumvals, ") + SUMPRODUCT(", sprintf(area.costcoeff, crow + i, crow + i), ", ", area.costvals, ")"), startCol = ccol + 2, startRow = crow + i); addStyle(wb, sheet, style = styles$pv0, rows = crow + i, cols = ccol + 2, stack = TRUE); @@ -803,7 +805,7 @@ exportInsuranceContract.xlsx = function(contract, filename) { fgFill = "#E0E0E0", halign = "center", valign = "center", textDecoration = "bold"), hide0 = createStyle(numFmt = "General; General; \"\""), - currency0 = createStyle(numFmt = "[$€-C07] #,##0.00;[red]-[$€-C07] #,##0.00;\"\""), + currency0 = createStyle(numFmt = "[$\u20ac C07] #,##0.00;[red]-[$\u20ac-C07] #,##0.00;\"\""), cost0 = createStyle(numFmt = "0.0##%; 0.0##%; \"\""), pv0 = createStyle(numFmt = "0.00000;-0.00000;\"\""), qx = createStyle(numFmt = "0.000000"), @@ -872,7 +874,7 @@ exportInsuranceContract.xlsx = function(contract, filename) { # Print out premium decomposition #### ############################################### # - sheet = "Prämienzerlegung"; + sheet = "Pr\\u00e4mienzerlegung"; addValuesWorksheet(wb, sheet); exportPremiumCompositionTable( wb = wb, sheet = sheet, contract = contract, diff --git a/R/showVmGlgExamples.R b/R/showVmGlgExamples.R index 3623364..7c89663 100644 --- a/R/showVmGlgExamples.R +++ b/R/showVmGlgExamples.R @@ -54,7 +54,7 @@ showVmGlgExamples = function(contract, prf=10, t=10, t_prf=12, file="", ...) { contract$tarif$desc, sprintf("Typ: %s", contract$tarif$tariffType), sprintf("VS: %.2f", contract$Parameters$ContractData$sumInsured), - sprintf("Alter: %d, LZ: %d, Prämienzahlung: %d, Aufschubzeit: %d, Garantiezeit: %d", + sprintf("Alter: %d, LZ: %d, Pr\\u00e4mienzahlung: %d, Aufschubzeit: %d, Garantiezeit: %d", contract$Parameters$ContractData$age, contract$Parameters$ContractData$policyPeriod, contract$Parameters$ContractData$premiumPeriod, @@ -66,21 +66,21 @@ showVmGlgExamples = function(contract, prf=10, t=10, t_prf=12, file="", ...) { contract$Parameters$ActuarialBases$mortalityTable@name), "", - "Prämien:", + "Pr\\u00e4mien:", "========", - sprintf("Nettoprämie: %8.2f", contract$Values$premiums["net"]), - sprintf("Zillmerprämie: %8.2f", contract$Values$premiums["Zillmer"]), - sprintf("Bruttoprämie: %8.2f", contract$Values$premiums["gross"]), + sprintf("Nettopr\\u00e4mie: %8.2f", contract$Values$premiums["net"]), + sprintf("Zillmerpr\\u00e4mie: %8.2f", contract$Values$premiums["Zillmer"]), + sprintf("Bruttopr\\u00e4mie: %8.2f", contract$Values$premiums["gross"]), sprintf("Vorgeschr.Pr.: %8.2f", contract$Values$premiums["written"]), "", - sprintf("Sparprämie (t=%d): %8.2f", t, contract$Values$premiumComposition[t + 1, "Zillmer.savings"]), - sprintf("Risikoprämie (t=%d): %8.2f", t, contract$Values$premiumComposition[t + 1, "Zillmer.risk"]), + sprintf("Sparpr\\u00e4mie (t=%d): %8.2f", t, contract$Values$premiumComposition[t + 1, "Zillmer.savings"]), + sprintf("Risikopr\\u00e4mie (t=%d): %8.2f", t, contract$Values$premiumComposition[t + 1, "Zillmer.risk"]), "", "Reserven:", "=========", - sprintf("Prämienpflichtig (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "Zillmer"]), + sprintf("Pr\\u00e4mienpflichtig (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "Zillmer"]), ifelse(has.prf, sprintf("Pr.Frei (mangels Zahlung) (tprf=%d): %8.2f", t_prf, contract.prf$Values$reserves[t_prf + 1, "Zillmer"]), ""), sprintf("VwKostenreserve (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "gamma"]), ifelse(has.prf, sprintf("VwKostenreserve (Pr.Frei) (tprf=%d): %8.2f", t_prf, contract.prf$Values$reserves[t_prf + 1, "gamma"]), ""), @@ -89,23 +89,23 @@ showVmGlgExamples = function(contract, prf=10, t=10, t_prf=12, file="", ...) { sprintf("Bilanzreserve (t=%.2f): %8.2f", contract$Values$reservesBalanceSheet[t + 1, "time"], contract$Values$reservesBalanceSheet[t + 1, "Balance Sheet Reserve"]), - sprintf("Prämienübertrag (BM=%2d): %8.2f", month(contract$Parameters$ContractData$contractClosing), contract$Values$reservesBalanceSheet[t + 1, "unearned Premiums"]), + sprintf("Pr\\u00e4mien\\u00fcbertrag (BM=%2d): %8.2f", month(contract$Parameters$ContractData$contractClosing), contract$Values$reservesBalanceSheet[t + 1, "unearned Premiums"]), "", - "Rückkauf und Prämienfreistellung:", + "R\\u00fcckkauf und Pr\\u00e4mienfreistellung:", "=================================", - sprintf("Rückkaufsreserve (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "reduction"]), - sprintf("Rückkaufswert (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "Surrender"]), - sprintf("Abschlusskostenrücktrag (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "alphaRefund"]), + sprintf("R\\u00fcckkaufsreserve (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "reduction"]), + sprintf("R\\u00fcckkaufswert (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "Surrender"]), + sprintf("Abschlusskostenr\\u00fccktrag (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "alphaRefund"]), "", - ifelse(has.prf, sprintf("Rückkaufswert (Prf.) (t=%d): %8.2f (VS: %.2f)", + ifelse(has.prf, sprintf("R\\u00fcckkaufswert (Prf.) (t=%d): %8.2f (VS: %.2f)", t_prf, contract.prf$Values$reserves[t_prf + 1, "Surrender"], contract.prf$Values$reserves[t_prf + 1, "PremiumFreeSumInsured"]), ""), "", - ifelse(has.prf, sprintf("Prämienfreie VS (t=%d): %8.2f", + ifelse(has.prf, sprintf("Pr\\u00e4mienfreie VS (t=%d): %8.2f", t, contract$Values$reserves[t + 1, "PremiumFreeSumInsured"]), "") ); cat(paste(output, collapse = '\r\n'), file = file) diff --git a/man/InsuranceContract.ParameterDefaults.Rd b/man/InsuranceContract.ParameterDefaults.Rd index 1053586..0be4491 100644 --- a/man/InsuranceContract.ParameterDefaults.Rd +++ b/man/InsuranceContract.ParameterDefaults.Rd @@ -6,7 +6,9 @@ \title{Default parameters for the InsuranceContract class. A new contract will be pre-filled with these values, and values passed in the constructor (or with other setter functions) will override these values.} -\format{An object of class \code{list} of length 8.} +\format{ +An object of class \code{list} of length 8. +} \usage{ InsuranceContract.ParameterDefaults } diff --git a/man/InsuranceContract.ParameterStructure.Rd b/man/InsuranceContract.ParameterStructure.Rd index 6b99b98..60d0e86 100644 --- a/man/InsuranceContract.ParameterStructure.Rd +++ b/man/InsuranceContract.ParameterStructure.Rd @@ -4,7 +4,9 @@ \name{InsuranceContract.ParameterStructure} \alias{InsuranceContract.ParameterStructure} \title{Full insurance contract parameter structure.} -\format{An object of class \code{list} of length 8.} +\format{ +An object of class \code{list} of length 8. +} \usage{ InsuranceContract.ParameterStructure } diff --git a/man/InsuranceContract.ParametersFallback.Rd b/man/InsuranceContract.ParametersFallback.Rd index acde077..12f96b1 100644 --- a/man/InsuranceContract.ParametersFallback.Rd +++ b/man/InsuranceContract.ParametersFallback.Rd @@ -4,8 +4,7 @@ \alias{InsuranceContract.ParametersFallback} \title{InsuranceContract.ParametersFallback} \usage{ -InsuranceContract.ParametersFallback(params, fallback, - ppParameters = TRUE) +InsuranceContract.ParametersFallback(params, fallback, ppParameters = TRUE) } \arguments{ \item{params}{Current, explicitly set contract parameters. All NULL values diff --git a/man/InsuranceContract.ParametersFill.Rd b/man/InsuranceContract.ParametersFill.Rd index fcac3e8..2f88767 100644 --- a/man/InsuranceContract.ParametersFill.Rd +++ b/man/InsuranceContract.ParametersFill.Rd @@ -4,9 +4,11 @@ \alias{InsuranceContract.ParametersFill} \title{InsuranceContract.ParametersFill} \usage{ - - InsuranceContract.ParametersFill(params = InsuranceContract.ParameterStructure, - costs = NULL, ...) +InsuranceContract.ParametersFill( + params = InsuranceContract.ParameterStructure, + costs = NULL, + ... +) } \arguments{ \item{params}{Initial values of the insurance contract parameters. (default: empty parameter structure)} diff --git a/man/InsuranceContract.Rd b/man/InsuranceContract.Rd index ca034ec..b342e4e 100644 --- a/man/InsuranceContract.Rd +++ b/man/InsuranceContract.Rd @@ -1,13 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/InsuranceContract.R -\docType{data} \name{InsuranceContract} \alias{InsuranceContract} \title{Base Class for Insurance Contracts} -\format{An object of class \code{R6ClassGenerator} of length 24.} -\usage{ -InsuranceContract -} \description{ R6 class that models a complete, general insurance contract. The corresponding tariff and the profit participation scheme, as well as @@ -18,4 +13,156 @@ explicitly overridden by the contract) can be given in the constructor. Immediately upon construction, all premiums, reserves and cash flows for the whole contract period are calculated. } -\keyword{datasets} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-new}{\code{InsuranceContract$new()}} +\item \href{#method-addHistorySnapshot}{\code{InsuranceContract$addHistorySnapshot()}} +\item \href{#method-addBlock}{\code{InsuranceContract$addBlock()}} +\item \href{#method-addDynamics}{\code{InsuranceContract$addDynamics()}} +\item \href{#method-calculateContract}{\code{InsuranceContract$calculateContract()}} +\item \href{#method-consolidateBlocks}{\code{InsuranceContract$consolidateBlocks()}} +\item \href{#method-premiumWaiver}{\code{InsuranceContract$premiumWaiver()}} +\item \href{#method-premiumWaiverOLD}{\code{InsuranceContract$premiumWaiverOLD()}} +\item \href{#method-profitScenario}{\code{InsuranceContract$profitScenario()}} +\item \href{#method-addProfitScenario}{\code{InsuranceContract$addProfitScenario()}} +\item \href{#method-clone}{\code{InsuranceContract$clone()}} +} +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-new"></a>}} +\if{latex}{\out{\hypertarget{method-new}{}}} +\subsection{Method \code{new()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$new( + tarif, + parent = NULL, + calculate = "all", + profitid = "default", + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-addHistorySnapshot"></a>}} +\if{latex}{\out{\hypertarget{method-addHistorySnapshot}{}}} +\subsection{Method \code{addHistorySnapshot()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$addHistorySnapshot( + time = 0, + comment = "Initial contract values", + type = "Contract", + params = self$Parameters, + values = self$Values, + tarif = self$tarif, + blocks = self$blocks +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-addBlock"></a>}} +\if{latex}{\out{\hypertarget{method-addBlock}{}}} +\subsection{Method \code{addBlock()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$addBlock( + id = NULL, + block = NULL, + t = block$Values$int$blockStart, + comment = comment, + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-addDynamics"></a>}} +\if{latex}{\out{\hypertarget{method-addDynamics}{}}} +\subsection{Method \code{addDynamics()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$addDynamics(t, NewSumInsured, SumInsuredDelta, id, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-calculateContract"></a>}} +\if{latex}{\out{\hypertarget{method-calculateContract}{}}} +\subsection{Method \code{calculateContract()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$calculateContract( + calculate = "all", + valuesFrom = 0, + premiumCalculationTime = 0, + preservePastPV = TRUE, + recalculatePremiums = TRUE, + recalculatePremiumSum = TRUE, + history_comment = NULL, + history_type = "Contract" +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-consolidateBlocks"></a>}} +\if{latex}{\out{\hypertarget{method-consolidateBlocks}{}}} +\subsection{Method \code{consolidateBlocks()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$consolidateBlocks(valuesFrom = 0)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-premiumWaiver"></a>}} +\if{latex}{\out{\hypertarget{method-premiumWaiver}{}}} +\subsection{Method \code{premiumWaiver()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$premiumWaiver(t)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-premiumWaiverOLD"></a>}} +\if{latex}{\out{\hypertarget{method-premiumWaiverOLD}{}}} +\subsection{Method \code{premiumWaiverOLD()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$premiumWaiverOLD(t)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-profitScenario"></a>}} +\if{latex}{\out{\hypertarget{method-profitScenario}{}}} +\subsection{Method \code{profitScenario()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$profitScenario(...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-addProfitScenario"></a>}} +\if{latex}{\out{\hypertarget{method-addProfitScenario}{}}} +\subsection{Method \code{addProfitScenario()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$addProfitScenario(id, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-clone"></a>}} +\if{latex}{\out{\hypertarget{method-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceContract$clone(deep = FALSE)}\if{html}{\out{</div>}} +} + +\subsection{Arguments}{ +\if{html}{\out{<div class="arguments">}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{</div>}} +} +} +} diff --git a/man/InsuranceContract.Values.Rd b/man/InsuranceContract.Values.Rd index c137be0..41dfe5b 100644 --- a/man/InsuranceContract.Values.Rd +++ b/man/InsuranceContract.Values.Rd @@ -4,7 +4,9 @@ \name{InsuranceContract.Values} \alias{InsuranceContract.Values} \title{Data structure (filled only with NULL) for insurance contract class member values.} -\format{An object of class \code{list} of length 16.} +\format{ +An object of class \code{list} of length 16. +} \usage{ InsuranceContract.Values } diff --git a/man/InsuranceTarif.Rd b/man/InsuranceTarif.Rd index e3a1399..f914c3c 100644 --- a/man/InsuranceTarif.Rd +++ b/man/InsuranceTarif.Rd @@ -1,13 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/InsuranceTarif.R -\docType{data} \name{InsuranceTarif} \alias{InsuranceTarif} \title{Base class for Insurance Tarifs, providing calculation functions to the contract} -\format{An object of class \code{R6ClassGenerator} of length 24.} -\usage{ -InsuranceTarif -} \description{ This is a base class for holding contract-independent values and providing methods to calculate cash flows, premiums, etc. Objects of this @@ -16,4 +11,351 @@ premiums, reserves, etc. Rather, they are the calculation kernels that will be called by the \code{\link{InsuranceContract}} objects to make the actual, tariff-specific calculations. } -\keyword{datasets} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-new}{\code{InsuranceTarif$new()}} +\item \href{#method-createModification}{\code{InsuranceTarif$createModification()}} +\item \href{#method-getParameters}{\code{InsuranceTarif$getParameters()}} +\item \href{#method-getInternalValues}{\code{InsuranceTarif$getInternalValues()}} +\item \href{#method-getAges}{\code{InsuranceTarif$getAges()}} +\item \href{#method-getTransitionProbabilities}{\code{InsuranceTarif$getTransitionProbabilities()}} +\item \href{#method-getCostValues}{\code{InsuranceTarif$getCostValues()}} +\item \href{#method-getPremiumCF}{\code{InsuranceTarif$getPremiumCF()}} +\item \href{#method-getAnnuityCF}{\code{InsuranceTarif$getAnnuityCF()}} +\item \href{#method-getDeathCF}{\code{InsuranceTarif$getDeathCF()}} +\item \href{#method-getBasicCashFlows}{\code{InsuranceTarif$getBasicCashFlows()}} +\item \href{#method-getCashFlows}{\code{InsuranceTarif$getCashFlows()}} +\item \href{#method-getCashFlowsCosts}{\code{InsuranceTarif$getCashFlowsCosts()}} +\item \href{#method-presentValueCashFlows}{\code{InsuranceTarif$presentValueCashFlows()}} +\item \href{#method-presentValueCashFlowsCosts}{\code{InsuranceTarif$presentValueCashFlowsCosts()}} +\item \href{#method-costValuesAsMatrix}{\code{InsuranceTarif$costValuesAsMatrix()}} +\item \href{#method-getAbsCashFlows}{\code{InsuranceTarif$getAbsCashFlows()}} +\item \href{#method-getAbsPresentValues}{\code{InsuranceTarif$getAbsPresentValues()}} +\item \href{#method-presentValueBenefits}{\code{InsuranceTarif$presentValueBenefits()}} +\item \href{#method-getPremiumCoefficients}{\code{InsuranceTarif$getPremiumCoefficients()}} +\item \href{#method-premiumCalculation}{\code{InsuranceTarif$premiumCalculation()}} +\item \href{#method-reserveCalculation}{\code{InsuranceTarif$reserveCalculation()}} +\item \href{#method-getBalanceSheetReserveFactor}{\code{InsuranceTarif$getBalanceSheetReserveFactor()}} +\item \href{#method-reserveCalculationBalanceSheet}{\code{InsuranceTarif$reserveCalculationBalanceSheet()}} +\item \href{#method-calculateProfitParticipation}{\code{InsuranceTarif$calculateProfitParticipation()}} +\item \href{#method-reservesAfterProfit}{\code{InsuranceTarif$reservesAfterProfit()}} +\item \href{#method-getBasicDataTimeseries}{\code{InsuranceTarif$getBasicDataTimeseries()}} +\item \href{#method-premiumDecomposition}{\code{InsuranceTarif$premiumDecomposition()}} +\item \href{#method-calculateFutureSums}{\code{InsuranceTarif$calculateFutureSums()}} +\item \href{#method-calculatePresentValues}{\code{InsuranceTarif$calculatePresentValues()}} +\item \href{#method-clone}{\code{InsuranceTarif$clone()}} +} +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-new"></a>}} +\if{latex}{\out{\hypertarget{method-new}{}}} +\subsection{Method \code{new()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$new( + name = NULL, + type = "wholelife", + tarif = "Generic Tarif", + desc = "Description of tarif", + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-createModification"></a>}} +\if{latex}{\out{\hypertarget{method-createModification}{}}} +\subsection{Method \code{createModification()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$createModification( + name = NULL, + tarif = NULL, + desc = NULL, + tariffType = NULL, + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getParameters"></a>}} +\if{latex}{\out{\hypertarget{method-getParameters}{}}} +\subsection{Method \code{getParameters()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getParameters()}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getInternalValues"></a>}} +\if{latex}{\out{\hypertarget{method-getInternalValues}{}}} +\subsection{Method \code{getInternalValues()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getInternalValues(params, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAges"></a>}} +\if{latex}{\out{\hypertarget{method-getAges}{}}} +\subsection{Method \code{getAges()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getAges(params)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getTransitionProbabilities"></a>}} +\if{latex}{\out{\hypertarget{method-getTransitionProbabilities}{}}} +\subsection{Method \code{getTransitionProbabilities()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getTransitionProbabilities(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getCostValues"></a>}} +\if{latex}{\out{\hypertarget{method-getCostValues}{}}} +\subsection{Method \code{getCostValues()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getCostValues(costs, params)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getPremiumCF"></a>}} +\if{latex}{\out{\hypertarget{method-getPremiumCF}{}}} +\subsection{Method \code{getPremiumCF()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getPremiumCF(len, params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAnnuityCF"></a>}} +\if{latex}{\out{\hypertarget{method-getAnnuityCF}{}}} +\subsection{Method \code{getAnnuityCF()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getAnnuityCF(len, params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getDeathCF"></a>}} +\if{latex}{\out{\hypertarget{method-getDeathCF}{}}} +\subsection{Method \code{getDeathCF()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getDeathCF(len, params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getBasicCashFlows"></a>}} +\if{latex}{\out{\hypertarget{method-getBasicCashFlows}{}}} +\subsection{Method \code{getBasicCashFlows()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getBasicCashFlows(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getCashFlows"></a>}} +\if{latex}{\out{\hypertarget{method-getCashFlows}{}}} +\subsection{Method \code{getCashFlows()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getCashFlows(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getCashFlowsCosts"></a>}} +\if{latex}{\out{\hypertarget{method-getCashFlowsCosts}{}}} +\subsection{Method \code{getCashFlowsCosts()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getCashFlowsCosts(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-presentValueCashFlows"></a>}} +\if{latex}{\out{\hypertarget{method-presentValueCashFlows}{}}} +\subsection{Method \code{presentValueCashFlows()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$presentValueCashFlows(cashFlows, params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-presentValueCashFlowsCosts"></a>}} +\if{latex}{\out{\hypertarget{method-presentValueCashFlowsCosts}{}}} +\subsection{Method \code{presentValueCashFlowsCosts()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$presentValueCashFlowsCosts(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-costValuesAsMatrix"></a>}} +\if{latex}{\out{\hypertarget{method-costValuesAsMatrix}{}}} +\subsection{Method \code{costValuesAsMatrix()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$costValuesAsMatrix(costValues)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAbsCashFlows"></a>}} +\if{latex}{\out{\hypertarget{method-getAbsCashFlows}{}}} +\subsection{Method \code{getAbsCashFlows()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getAbsCashFlows(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAbsPresentValues"></a>}} +\if{latex}{\out{\hypertarget{method-getAbsPresentValues}{}}} +\subsection{Method \code{getAbsPresentValues()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getAbsPresentValues(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-presentValueBenefits"></a>}} +\if{latex}{\out{\hypertarget{method-presentValueBenefits}{}}} +\subsection{Method \code{presentValueBenefits()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$presentValueBenefits(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getPremiumCoefficients"></a>}} +\if{latex}{\out{\hypertarget{method-getPremiumCoefficients}{}}} +\subsection{Method \code{getPremiumCoefficients()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getPremiumCoefficients( + type = "gross", + coeffBenefits, + coeffCosts, + premiums, + params, + values, + premiumCalculationTime = values$int$premiumCalculationTime +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-premiumCalculation"></a>}} +\if{latex}{\out{\hypertarget{method-premiumCalculation}{}}} +\subsection{Method \code{premiumCalculation()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$premiumCalculation( + params, + values, + premiumCalculationTime = values$int$premiumCalculationTime +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-reserveCalculation"></a>}} +\if{latex}{\out{\hypertarget{method-reserveCalculation}{}}} +\subsection{Method \code{reserveCalculation()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$reserveCalculation(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getBalanceSheetReserveFactor"></a>}} +\if{latex}{\out{\hypertarget{method-getBalanceSheetReserveFactor}{}}} +\subsection{Method \code{getBalanceSheetReserveFactor()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getBalanceSheetReserveFactor(params, years = 1)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-reserveCalculationBalanceSheet"></a>}} +\if{latex}{\out{\hypertarget{method-reserveCalculationBalanceSheet}{}}} +\subsection{Method \code{reserveCalculationBalanceSheet()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$reserveCalculationBalanceSheet(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-calculateProfitParticipation"></a>}} +\if{latex}{\out{\hypertarget{method-calculateProfitParticipation}{}}} +\subsection{Method \code{calculateProfitParticipation()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculateProfitParticipation(params, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-reservesAfterProfit"></a>}} +\if{latex}{\out{\hypertarget{method-reservesAfterProfit}{}}} +\subsection{Method \code{reservesAfterProfit()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$reservesAfterProfit(profitScenario, params, values, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getBasicDataTimeseries"></a>}} +\if{latex}{\out{\hypertarget{method-getBasicDataTimeseries}{}}} +\subsection{Method \code{getBasicDataTimeseries()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$getBasicDataTimeseries(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-premiumDecomposition"></a>}} +\if{latex}{\out{\hypertarget{method-premiumDecomposition}{}}} +\subsection{Method \code{premiumDecomposition()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$premiumDecomposition(params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-calculateFutureSums"></a>}} +\if{latex}{\out{\hypertarget{method-calculateFutureSums}{}}} +\subsection{Method \code{calculateFutureSums()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculateFutureSums(values, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-calculatePresentValues"></a>}} +\if{latex}{\out{\hypertarget{method-calculatePresentValues}{}}} +\subsection{Method \code{calculatePresentValues()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$calculatePresentValues(values, params)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-clone"></a>}} +\if{latex}{\out{\hypertarget{method-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{InsuranceTarif$clone(deep = FALSE)}\if{html}{\out{</div>}} +} + +\subsection{Arguments}{ +\if{html}{\out{<div class="arguments">}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{</div>}} +} +} +} diff --git a/man/ProfitParticipation.Rd b/man/ProfitParticipation.Rd index db67ada..b909ff7 100644 --- a/man/ProfitParticipation.Rd +++ b/man/ProfitParticipation.Rd @@ -1,16 +1,144 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/ProfitParticipation.R -\docType{data} \name{ProfitParticipation} \alias{ProfitParticipation} \title{Base Class for Profit Participation Schemes} -\format{An object of class \code{R6ClassGenerator} of length 24.} -\usage{ -ProfitParticipation -} \description{ base class for Profit Participation schemes (holding contract-independent values and providing methods to calculate the profit participation values from the given reserves). } -\keyword{datasets} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-new}{\code{ProfitParticipation$new()}} +\item \href{#method-setParameters}{\code{ProfitParticipation$setParameters()}} +\item \href{#method-setFunctions}{\code{ProfitParticipation$setFunctions()}} +\item \href{#method-setFallbackParameters}{\code{ProfitParticipation$setFallbackParameters()}} +\item \href{#method-createModification}{\code{ProfitParticipation$createModification()}} +\item \href{#method-getAdvanceProfitParticipation}{\code{ProfitParticipation$getAdvanceProfitParticipation()}} +\item \href{#method-getAdvanceProfitParticipationAfterUnitCosts}{\code{ProfitParticipation$getAdvanceProfitParticipationAfterUnitCosts()}} +\item \href{#method-setupRates}{\code{ProfitParticipation$setupRates()}} +\item \href{#method-adjustRates}{\code{ProfitParticipation$adjustRates()}} +\item \href{#method-getProfitParticipation}{\code{ProfitParticipation$getProfitParticipation()}} +\item \href{#method-clone}{\code{ProfitParticipation$clone()}} +} +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-new"></a>}} +\if{latex}{\out{\hypertarget{method-new}{}}} +\subsection{Method \code{new()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$new(name = NULL, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-setParameters"></a>}} +\if{latex}{\out{\hypertarget{method-setParameters}{}}} +\subsection{Method \code{setParameters()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$setParameters(...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-setFunctions"></a>}} +\if{latex}{\out{\hypertarget{method-setFunctions}{}}} +\subsection{Method \code{setFunctions()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$setFunctions(...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-setFallbackParameters"></a>}} +\if{latex}{\out{\hypertarget{method-setFallbackParameters}{}}} +\subsection{Method \code{setFallbackParameters()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$setFallbackParameters()}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-createModification"></a>}} +\if{latex}{\out{\hypertarget{method-createModification}{}}} +\subsection{Method \code{createModification()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$createModification(name = NULL, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAdvanceProfitParticipation"></a>}} +\if{latex}{\out{\hypertarget{method-getAdvanceProfitParticipation}{}}} +\subsection{Method \code{getAdvanceProfitParticipation()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$getAdvanceProfitParticipation(params, values, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getAdvanceProfitParticipationAfterUnitCosts"></a>}} +\if{latex}{\out{\hypertarget{method-getAdvanceProfitParticipationAfterUnitCosts}{}}} +\subsection{Method \code{getAdvanceProfitParticipationAfterUnitCosts()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$getAdvanceProfitParticipationAfterUnitCosts( + params, + values, + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-setupRates"></a>}} +\if{latex}{\out{\hypertarget{method-setupRates}{}}} +\subsection{Method \code{setupRates()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$setupRates(params, values, ...)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-adjustRates"></a>}} +\if{latex}{\out{\hypertarget{method-adjustRates}{}}} +\subsection{Method \code{adjustRates()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$adjustRates(rates, params, values)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-getProfitParticipation"></a>}} +\if{latex}{\out{\hypertarget{method-getProfitParticipation}{}}} +\subsection{Method \code{getProfitParticipation()}}{ +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$getProfitParticipation( + calculateFrom = 0, + profitScenario = NULL, + params, + values, + ... +)}\if{html}{\out{</div>}} +} + +} +\if{html}{\out{<hr>}} +\if{html}{\out{<a id="method-clone"></a>}} +\if{latex}{\out{\hypertarget{method-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{<div class="r">}}\preformatted{ProfitParticipation$clone(deep = FALSE)}\if{html}{\out{</div>}} +} + +\subsection{Arguments}{ +\if{html}{\out{<div class="arguments">}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{</div>}} +} +} +} diff --git a/man/ProfitParticipationFunctions.Rd b/man/ProfitParticipationFunctions.Rd index 544f91d..89782c4 100644 --- a/man/ProfitParticipationFunctions.Rd +++ b/man/ProfitParticipationFunctions.Rd @@ -82,14 +82,27 @@ PP.rate.interestProfit2(rates, ...) PP.calculate.RateOnBase(base, rate, waiting, rates, params, values, ...) -PP.calculate.RateOnBaseMin0(base, rate, waiting, rates, params, values, - ...) - -PP.calculate.RatePlusGuaranteeOnBase(base, rate, waiting, rates, params, - values, ...) - -PP.calculate.RateOnBaseSGFFactor(base, rate, waiting, rates, params, - values, ...) +PP.calculate.RateOnBaseMin0(base, rate, waiting, rates, params, values, ...) + +PP.calculate.RatePlusGuaranteeOnBase( + base, + rate, + waiting, + rates, + params, + values, + ... +) + +PP.calculate.RateOnBaseSGFFactor( + base, + rate, + waiting, + rates, + params, + values, + ... +) PP.benefit.ProfitPlusTerminalBonusReserve(profits, ...) diff --git a/man/addDataTableWorksheet.Rd b/man/addDataTableWorksheet.Rd index 8437d0d..ed66359 100644 --- a/man/addDataTableWorksheet.Rd +++ b/man/addDataTableWorksheet.Rd @@ -4,9 +4,18 @@ \alias{addDataTableWorksheet} \title{Add a new worksheet to the excel workbook and export the given data table x to it nicely formatted.} \usage{ -addDataTableWorksheet(wb, sheet, title = NULL, x = NULL, loopdim = 3, - style = NULL, tableStyle = "TableStyleMedium17", - comparisons = NULL, comparisonStyle = NULL, ...) +addDataTableWorksheet( + wb, + sheet, + title = NULL, + x = NULL, + loopdim = 3, + style = NULL, + tableStyle = "TableStyleMedium17", + comparisons = NULL, + comparisonStyle = NULL, + ... +) } \description{ Add a new worksheet to the excel workbook and export the given data table x to it nicely formatted. diff --git a/man/contractGrid.Rd b/man/contractGrid.Rd index aa674be..6f82335 100644 --- a/man/contractGrid.Rd +++ b/man/contractGrid.Rd @@ -8,8 +8,12 @@ This function will return the full InsuranceContract objects, so apply can later be used to extract premiums, reserves and other values to display in a grid.} \usage{ -contractGrid(axes = list(age = seq(20, 60, 10), policyPeriod = seq(5, 35, - 5)), YOB = NULL, observationYear = NULL, ...) +contractGrid( + axes = list(age = seq(20, 60, 10), policyPeriod = seq(5, 35, 5)), + YOB = NULL, + observationYear = NULL, + ... +) } \description{ Create a multi-dimensional grid of InsuranceContract objects, where the axes diff --git a/man/exportInsuranceContractExample.Rd b/man/exportInsuranceContractExample.Rd index cbfc50b..d9da741 100644 --- a/man/exportInsuranceContractExample.Rd +++ b/man/exportInsuranceContractExample.Rd @@ -4,8 +4,14 @@ \alias{exportInsuranceContractExample} \title{Export the example calculations of an insurance contract} \usage{ -exportInsuranceContractExample(contract, prf = 10, outdir = ".", - basename = NULL, extraname = NULL, ...) +exportInsuranceContractExample( + contract, + prf = 10, + outdir = ".", + basename = NULL, + extraname = NULL, + ... +) } \arguments{ \item{contract}{The \code{\link{InsuranceContract}} object to be exported} diff --git a/man/initializeCosts.Rd b/man/initializeCosts.Rd index 7acede4..e08bf5c 100644 --- a/man/initializeCosts.Rd +++ b/man/initializeCosts.Rd @@ -8,8 +8,17 @@ Period: once, PremiumPeriod, PremiumFree, PolicyPeriod TODO: gamma an Erlebensleistungen?} \usage{ -initializeCosts(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, - gamma.premiumfree, unitcosts, unitcosts.PolicyPeriod) +initializeCosts( + costs, + alpha, + Zillmer, + beta, + gamma, + gamma.paidUp, + gamma.premiumfree, + unitcosts, + unitcosts.PolicyPeriod +) } \description{ Initialize a cost matrix with dimensions: [CostType, Basis, Period], with: diff --git a/man/showVmGlgExamples.Rd b/man/showVmGlgExamples.Rd index 646f937..90bebf1 100644 --- a/man/showVmGlgExamples.Rd +++ b/man/showVmGlgExamples.Rd @@ -4,8 +4,7 @@ \alias{showVmGlgExamples} \title{Display insurance contract calculation example} \usage{ -showVmGlgExamples(contract, prf = 10, t = 10, t_prf = 12, - file = "", ...) +showVmGlgExamples(contract, prf = 10, t = 10, t_prf = 12, file = "", ...) } \arguments{ \item{contract}{The insurance contract to calculate and show} diff --git a/vignettes/using-the-lifeinsurancecontracts-package.Rmd b/vignettes/using-the-lifeinsurancecontracts-package.Rmd index dcc5ee9..0db1e7a 100644 --- a/vignettes/using-the-lifeinsurancecontracts-package.Rmd +++ b/vignettes/using-the-lifeinsurancecontracts-package.Rmd @@ -13,7 +13,7 @@ output: fig_width: 7 fig_height: 5 vignette: > - %\VignetteIndexEntry{Vignette Title} + %\VignetteIndexEntry{Using the LifeInsuranceContracts Package} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- -- GitLab