## May the rule be with you ;)

Actuaries are not famous for their sense of humour. Sometimes, they exhibit a remarkable sense of it though!

A second year undergrad student is familiar with the following formula,

where X is a random variable satisfying with probability 1. Most call the right tail and others the survival function of X,denoted by . This is a really convenient way to calculate expected values instead of using integration by parts.

Actuaries find this quite handy especially when dealing with deductibles that shift the variable or stop limits that truncate the variable from above. The first is usually treated whether the latter makes no real difference as the survival function will be 0 over the stop limit.

Where’s the joke that actuaries tipped in? Well, they called this the *Darth Vader Rule* given that Darth Vader was a true survivor…

Below you can see the expected value of a Gamma(2,5) random variable.

To get the plot it’s easy with Mathematica for instance.

Plot[CDF[GammaDistribution[2, 5], x], {x, 0, 25}, PlotRange -> {{0, 29}, {0, 1}}, Filling -> Top]

Next calculate the expected value.

Integrate[1 – CDF[GammaDistribution[2, 5], z], {z, 0, 25}] // N

9.76417

## This is alpha+…

It’s great. It could be the new google for us I can see this coming…

Wolfram’s Alpha goes NYSE : Quote NBG (National Bank of Greece)

## A merry wolfram xmas!

Christmas coming & time for fun! Wolfram’s demonstrations give you a sense of the holiday season along some nice demonstrations. I particulary like the “Ornamental Holiday Decoration”

Manipulate[ Module[{level0, level1, level2}, level0 = C[spikey, 0]; level1 = Flatten[daughterPolyhedra[C[spikey, 0], {d1, ω1, s1}, ρ s1]]; level2 = Flatten[daughterPolyhedra[#, {d2, ω2, s2}, ρ s1 s2] & /@ Cases[level1, _C]]; Graphics3D[{EdgeForm[], {Red, egc[level0]}, gg1 = {col1, egc[level1]}, gg2 = {col2, ControlActive[{}, egc[level2]]}, Directive[GrayLevel[0.2], Specularity[colc, 12]], ecc[{level1, level2}]}, Boxed -> False, ImageSize -> {400, 400}]], "layer 1:", {{d1, 1.5, "distance"}, -3, 3, ImageSize -> Tiny}, {{ω1, 0, "rotation"}, -Pi, Pi, ImageSize -> Tiny}, {{s1, 1/2, "size"}, 0, 1, ImageSize -> Tiny}, {{col1, Yellow, "color"}, Blue, ControlType -> None}, Delimiter, "layer 2:", {{d2, 1, "distance"}, -3, 3, ImageSize -> Tiny}, {{ω2, 0, "rotation"}, -Pi, Pi, ImageSize -> Tiny}, {{s2, 1/2, "size"}, 0, 1, ImageSize -> Tiny}, {{col2, Green, "color"}, Green, ControlType -> None}, Delimiter, "connectors:", {{ρ, 0.3, "radius"}, 0, 1, ImageSize -> Tiny}, {{colc, Brown, "color"}, Yellow, ControlType -> None}, AutorunSequencing -> {1, 3, 5, 7}, Initialization :> { spikey = MapAt[Developer`ToPackedArray, MapAt[Developer`ToPackedArray, N[PolyhedronData["Spikey"]][[1]], 1], {2, 1}]; mirrorRotateAndShift[gc_GraphicsComplex, n_, {distance_, angle_, size_}, ρ_] := With[{aux = mirrorRotateAndShiftCF[gc[[1]], gc[[1, n]], distance, angle, size]}, {C[GraphicsComplex[aux, gc[[2]]], n], Cylinder[{gc[[1, n]], aux[[n]]}, ρ]}]; mirrorRotateAndShiftCF = Compile[{{vertices, _Real, 2}, {rPoint, _Real, 1}, distance, angle, size}, Read more...

## Web analytics revisited : The Mathematica way!

I found out something really interesting. Men do it with keyboards (not clicks!) and so does Patrick Collison using Mathematica to analyse web data he got from Google Analytics.

*See* : Hacking for fun and profit with Mathematica and the Google Analytics API [link]

## Simulating the maximum…

Studying the distributional properties of the maximum is gaining more of attention nowadays given the relative failure of the conventional tools the quants used before the recession.

Let’s suppose that an insurance company faces the challenge to cover claims incurring in random time and size. The intensity of the process is , and the process itself is (surprise!!!) Poisson. The claims are iid from a lognormal distribution with parameters and , where is the intermediate time between occurence and .

Some Mathematica code from my Graduate Simulation class is the following.

First we set up the intersity function and the generic vectors recoring Claims (Claimsv) and maximums (Maxv)

λ0 = 25; t0 = 1;

λ[t_] := 100 (t – t^2); Claimsv = {}; Maxv = {};

The main program is the following

Do[S = {}; t = 0; n = 0;

X = -Log[Random[]]/λ0; t = t + X;

While[t < t0, If[Random[] < λ[t]/λ0, n = n + 1; S = Append[S, t]];

X = -Log[Random[]]/λ0; t = t + X];

Claims = 0; S[[0]] = 0; Maxx = 0; Do[rr = Exp[

Random[NormalDistribution[0.75*(S[[i]] – S[[i – 1]]), 1]]];

If[rr > Maxx, Maxx = rr];

Claims = Claims + rr, {i, 1, n}] AppendTo[Claimsv, Claims];

AppendTo[Maxv, Maxx];, {10000}]

And plotting the histograms of the simulated distribution of the Claims and the maximum we nearly finished…

<< Histograms`

Histogram[Claims.v]

Histogram[Max.v]

*to be continued…*