contractGrid | R Documentation |
The function contractGrid
creates a (two- or multi-dimensional) grid
of InsuranceContract objects, where each axis represents one of the insurance
parameters varying as given in the axes
argument (as a named list).
The function contractGridPremium
returns a grid of premiums as requested in
the premium
parameter rather than the full InsuranceContract objects.
It is a convenience wrapper around contractGrid
and is recommended if
one is only interested in a grid of one particular value (typically some
kind of premium).
The function contractGridPremium
can also be used on an existing
contractGrid
-generated grid of contracts to extract grid of numerical
values of the specified premiums. If no contract grid is passed to
contractGridPremium
, contractGrid
will be called to create it.
contractGrid( axes = list(age = seq(20, 60, 10), policyPeriod = seq(5, 35, 5)), YOB = NULL, observationYear = NULL, ... ) contractGridPremium( contractGrid = NULL, premium = "written", .fun = function(cntr) { cntr$Values$premiums[[premium]] }, ... )
axes |
List of paramters spanning the dimensions of the grid. |
YOB |
optional year of bith. If missing, the |
observationYear |
The observation year, for which the grid shall be calculated. If given, the YOB is calculated from it, otherwise the contract's YOB is used |
... |
In |
contractGrid |
(optional) existing contract grid from which to derive
premiums. If not given, contractGrid is called with all parameters, so
|
premium |
The type of premium to derive (key of the |
.fun |
The function to extract the desired premium from a contract
object. By default it accesses the premium vector and extracts the
type of premium given in the |
The function contractGrid
will return the full InsuranceContract
objects, so apply can later be used to extract premiums, reserves and other
values to display in a grid. For this feature, one can also use the convenience
function contractGridPremium
.
The axes
list describing the parameters changing along the axes of the
resulting grid is internally expanded with expand.grid()
. The resulting flat
list of parameter (together with the fixed parameters passed as ...
)
is then passed to the InsuranceContract$new()
call to create the corresponding
contract object.
To create the human-readable row-/columnnames of the resulting array,
the function makeContractGridDimname()
for each value of the axes, allowing
human-readable representations e.g. of a tariff or a mortality table as
the dimension label.
# TODO
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.