Learn R Programming

The LifeInsureR Package For Traditional Life Insurance with Guarantee and Profit Participation

R package implementing general life insurance contracts

This package 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 contract period are calculated and potentially exported to 'Excel'. Mortalities are given using the 'MortalityTables' package.

Copy Link

Version

Install

install.packages('LifeInsureR')

Monthly Downloads

634

Version

1.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Reinhold Kainhofer

Last Published

June 15th, 2025

Functions in LifeInsureR (1.0.1)

CalculationSingleEnum-class

Enum to define how much of a contract needs to be calculated automatically.
InsuranceContract.ParametersFill

Initialize the insurance contract parameters from passed arguments
PVfactory

PVfactory (R6Class for present values with arbitrary dimensions)
InsuranceContract.ParameterStructure

Full insurance contract parameter structure.
InsuranceContract.ParametersFallback

Use fallback values for missing contract parameters
PaymentTimeSingleEnum-class

Enum to describe when a benefit or premium payment is due (in advance or in arrears)
InsuranceContract

Base Class for Insurance Contracts
InsuranceTarif

Base class for traditional Insurance Tarifs (with fixed guarantee, profit sharing and no unit-linked component)
InsuranceContract.Values

Data structure (filled only with NULL) for insurance contract class member values.
InsuranceContract.ParameterDefaults

Default parameters for the InsuranceContract class.
ProfitParticipationFunctions

Helper functions for profit participation
costValuesAsDF

Convert the multi-dimensional costs array to a data.frame for output to a file
SexSingleEnum-class

Enum to describe possible sexes in an insurance contract or tariff.
RoundingHelper

Helper object to define rounding rules for the InsuranceContract, InsuranceTarif and ProfitParticipation classes.
contractGrid

Create a grid of InsuranceContract objects or premiums with each axis representing one varying parameter
TariffTypeSingleEnum-class

An enum specifying the main characteristics of the tarif.
ProfitComponentsMultipleEnum-class

Enum to define the different components of profit participation.
age.exactRounded

Calculate the age of the insured based on exact age at contract closing, rounded to the nearest birthday.
applyHook

If hook is a function, apply it to val, otherwise return val unchanged
age.yearDifference

Calculate the age of the insured based on the difference of the bith year and contract closing year.
ProfitParticipation

Base Class for Profit Participation Schemes
exportInsuranceContract.xlsx

Export an insurance contract (object of class InsuranceContract) to an 'Excel' file
isRegularPremiumContract

Determine whether a contract (given all parameters) is a contract with regular premiums
initializeCosts

Initialize or modify a data structure for the definition of InsuranceTarif costs
costs.baseAlpha

Helper function to define base costs with base alpha, but otherwise unchanged costs
premiumRefundPeriod.default

Default premium refund period: for deferred contracts the deferral period, otherwise the whole contract
rollingmean

Calculate the rolling mean of length 2
costs.scaleAlpha

Helper function to modify alpha costs of an insurance contract individually
fallbackFields

Replace missing values in ields by default fallback values
fillNAgaps

Replace all NA entries of a vector with the previous non-NA value
fillFields

Overwrite all existing fields with default values given
filterProfitRates

Filter the whole data.frame of profit rates for the given profit classes
padLast

Pad the vector v to length l by repeating the last entry of the vector.
vmGlgExample.generateTest

Generate testthat output for unit-testing a tarif implementation
pad0

Pad a vector with 0 to a desired length
costsDisplayTable

Helper function to display all cost definitions in a concise table
valueOrFunction

If val is a function, evaluate it, otherwise return val
testVmGlgExample

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

Export the example calculations of an insurance contract
head0

Set all entries of the given vector to 0 up until index 'start'
freqCharge

Defines a frequency charge (surcharge for monthly/quarterly/semiannual) premium payments
isSinglePremiumContract

Determine whether a contract (given all parameters) is a single-premium contract or with regular premiums
makeContractGridDimname

Create human-readable labels for the dimensions in a contractGrid()
deathBenefit.linearDecreasing

Describes the death benefit of a linearly decreasing whole life insurance (after a possible deferall period)
setCost

Update one component of an InsuranceTarif's cost structure
deathBenefit.annuityDecreasing

Describes the death benefit of a decreasing whole life insurance (after a possible deferall period)
showVmGlgExamples

Display insurance contract calculation example