Modeling with objects

MR-dice-icon.png Download a pdf copy of this help file  here

See also: Graphics, workflow and error handling in ModelRisk, Aggregate modeling in ModelRisk, Distributions in ModelRisk

image1094.gif






1Excel_icon.gif Example model

Whenever a ModelRisk function takes a distribution as argument rather than a sampled value from it, this argument should be provided as a distribution object function.

Using distribution Objects has the great advantage that you can keep your distributional assumptions in once place in the model, making it easier to maintain and update (analogous to keep your constants in one place).

For each distribution, time series and copula in ModelRisk, there is a corresponding Object and a Fit Object function available for further use as an argument in other ModelRisk functions. Both types behave the same, but have their parameters specified in a different way: Object functions are directly specified by their parameters, and Fit Object functions are specified by the array of data they are fitted to. ModelRisk then determines parameter values that best fit the data.

It is important to know that the VoseDistributionObject functions are in essence only "placeholders", i.e. creating them executes no algorithm. The algorithms are only executed when another VoseFunction calls the object as argument. The VoseDistributionFitObject functions are a different case: when inserting a fitted object, the fitted parameters are immediately calculated and contained in the object. Any further actions done on this fitted object will again only execute upon calling the object (e.g. calculating a probability with VoseProb)

There is a Distribution Object function for every distribution in ModelRisk, including custom distributions (e.g. VoseCombined, VoseDeduct, VoseRiskEvent, VoseAggregateFFT). So all of these can be used further as argument in other ModelRisk functions.

It makes logical sense to differ between a distribution as a whole, and a random value sampled from that distribution. It would be conceptually wrong and inconsistent to have the same function playing both roles.

To make your model as easy to maintain, review and update as possible we consider it good practice to store each used Distribution, Time Series or Copula (see below) object only once and in a separate spreadsheet cell, and refer to that cell from other ModelRisk functions.

A simple example: calculating moments of a distribution

Looking at a simple example, the sense of modeling with objects - in particular the fact that they are separate functions - becomes clear immediately. To sample random values from a Normal(0,1) distribution - for example when doing MC simulation - you would insert this formula in a spreadsheet cell:

=VoseNormal(0,1)

On the other hand, if you need the statistical moments of that same distribution in your model, you would use the VoseMoments function. The corresponding spreadsheet formula is

{=VoseMoments(VoseDistributionObject(1,2,3))}

because you want the moments of the distribution as a whole. The VoseMoments function has a 4 x 2 output, as shown below (it is an array function):

MR_VoseMoments_example.jpg

Now if we would also want to create an array with 100 sampled values from that distribution, we could write =VoseSimulate(B2) in the entire array. To calculate the cumulative probability of a given x-value occurring under this same distribution, we would write =VoseProb(x,B2,1).

If we would not know the parameters of the Normal distribution, but rather like to estimate them from available data, we would replace the VoseNormalObject with a VoseNormalFitObject and all the other calculations would still be performed in the same matter.

Similarly, if we would like to do all of the aforementioned calculations on any other distribution, we would just replace cell B1 with any other (for example an aggregate FFT) distribution object.

The image below illustrates modeling with objects schematically.

image434.gif

 

An example from insurance risk analysis

See also: Accident insurance

ModelRisk has a range of special functions that convert a distribution object into another object.

For example we can use VoseDeduct to create a modified claim severity distribution:

=VoseDeductObject(CostDistributionObject, deductible, maxlimit, zeros)

The zero parameter is either TRUE or FALSE (or omitted). If FALSE, the DeductObject has no probability mass at zero, i.e. it is the distribution of a claim size given that a claim has occurred. If TRUE, the DeductObject has probability mass at zero, i.e. it is the distribution of a claim size given that a risk event has occurred. The DeductObject is a distribution that can be used in turn as argument for other ModelRisk functions.

We start with a Lognormal(10,7) distribution and apply a deductible and limit:

A1:      =VoseLognormalObject(10,7)

A2:      =VoseDeductObject(A1, 5, 25, TRUE)

The object in cell A2 can then be used in recursive (like Panjer and De Pril available in ModelRisk ) and FFT aggregate methods, since these methods discretize the individual loss distribution and can therefore take care of a discrete-continuous mixture. Thus, we can use, for example:

=VoseAggregateFFT(VosePoissonObject(2700),A2)

to simulate the cost of Poisson(2700) random claims. Or

=VoseAggregateFFT(VosePoissonObject(2700),A2,0.99)

using the U parameter to calculate the 99th percentile of the aggregate cost of Poisson(2700) random claims.

Time series and copula objects

Similarly to distribution objects, ModelRisk has time series objects and copula objects. For time series or copulas fitted to data there are also FitObject functions. Use these to create an object for a copula or time series in one place, and then use the VoseTimeSimulate and VoseCopulaSimulate functions to generate random values.

Using these of course provides the same advantage as distribution Objects: they allow you to keep the assumptions about Time Series or Copula model in one place in the spreadsheet. Imagine having used a Clayton copula for modeling correlation all through your model, and deciding later on it is better to switch to a Gumbel. If you set up your model correctly, this should only require a change in one cell.