testVmGlgExample: Perform unit tests of given standard values of the insurance...

View source: R/showVmGlgExamples.R

testVmGlgExampleR Documentation

Perform unit tests of given standard values of the insurance contract example

Description

Check the values of the example calculation of the given insurance contract as required by the Austrian regulation (LV-VMGLV, "LV Versicherungsmathematische Grundlagen Verordnung"). Missing params not passed to the function call will be silently ignored and not cause unit test failures.

Usage

testVmGlgExample(
  contract,
  prf = 10,
  t = 10,
  t_prf = 12,
  net,
  Zillmer,
  gross,
  written,
  savings,
  risk,
  ZillmerRes,
  ZillmerRes.prf,
  VwKostenRes,
  VwKostenRes.prf,
  Bilanzreserve,
  Praemienuebertrag,
  Rueckkaufsreserve,
  Rueckkaufswert,
  Abschlusskostenruecktrag,
  Rueckkaufswert.prf,
  VS.prf,
  absTolerance = 0.015,
  ...
)

Arguments

contract

The insurance contract to calculate and check

prf

Time of premium waiver (premium-free)

t

Time for which to check all values (except premium-free values)

t_prf

Time for which to check all values after the premium waiver

net, Zillmer, gross, written, savings, risk, ZillmerRes, ZillmerRes.prf, VwKostenRes, VwKostenRes.prf, Bilanzreserve, Praemienuebertrag, Rueckkaufsreserve, Rueckkaufswert, Abschlusskostenruecktrag, Rueckkaufswert.prf, VS.prf

Values as printed out by showVmGlgExamples

absTolerance

If non-NULL, will ignore small floating point differences. It uses same algorithm as all.equal()

...

Further parameters for generating the contract for a tariff object

Details

The easiest way to write unit-tests is using the function vmGlgExample.generateTest

Examples

library(MortalityTables)
mortalityTables.load("Austria_Annuities_AVOe2005R")

## Not run: 
test_that("Testtarif", {
    # A trivial deferred annuity tariff with no costs:
    tariff = InsuranceTarif$new(name="Test Annuity", type="annuity",
        mortalityTable = AVOe2005R.unisex, i=0.01)
    contract = InsuranceContract$new(
        tariff,
        age = 35, YOB = 1981,
        policyPeriod = 30, premiumPeriod = 15, deferralPeriod = 15,
        sumInsured = 1000,
        contractClosing = as.Date("2016-10-01")
    );

    testVmGlgExample(
        contract, t = 10,
        net = 850.09, # NOT_CHECKED: Zillmer = 950.09,
        gross = 850.09,
        written = 884.09,
        savings = 857.09, risk = -7.00,
        ZillmerRes = 9011.40,
        ZillmerRes.prf = 9205.96,
        VwKostenRes = 0.00,
        VwKostenRes.prf = 0.00,
        Bilanzreserve = 9250.35,
        Praemienuebertrag = 212.52,
        Rueckkaufsreserve = 9011.40,
        Rueckkaufswert = 9011.40,
        Abschlusskostenruecktrag = 0.00,
        Rueckkaufswert.prf = 9205.96,
        VS.prf = 685.12
    )
})

## End(Not run)


kainhofer/r-life-insurance-contracts documentation built on Sept. 18, 2022, 7:56 p.m.