The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Worked Example

A worked example follows to serve as motivation for the use case.

TODO

library(eltr)

raw_elt <-example_elt

Calculate ELT parameters and modify raw ELT table

elt <- create_elt(raw_elt, ann_rate="rate", mu="mean", sdev_i = "sdevi" , sdev_c = "sdevc", expval = "exp")

elt
#>     id rate  mean sdevi sdevc     exp       mdr sdev  cov        alpha
#>  1:  1 0.10   500   500   200  100000 0.0050000  700 1.40  0.502653061
#>  2:  2 0.10   200   400   100    5000 0.0400000  500 2.50  0.113600000
#>  3:  3 0.20   300   200   400   40000 0.0075000  600 2.00  0.240625000
#>  4:  4 0.10   100   300   500    4000 0.0250000  800 8.00 -0.009765625
#>  5:  5 0.20   500   100   200    2000 0.2500000  300 0.60  1.833333333
#>  6:  6 0.25   200   200   500   50000 0.0040000  700 3.50  0.077306122
#>  7:  7 0.01  1000   500   600  100000 0.0100000 1100 1.10  0.808181818
#>  8:  8 0.12   250   300   100    5000 0.0500000  400 1.60  0.321093750
#>  9:  9 0.14  1000   500   200    6000 0.1666667  700 0.70  1.534013605
#> 10: 10 0.00 10000  1000   500 1000000 0.0100000 1500 0.15 43.990000000
#>             beta  random_num
#>  1:  100.0279592 0.081967213
#>  2:    2.7264000 0.081967213
#>  3:   31.8427083 0.163934426
#>  4:   -0.3808594 0.081967213
#>  5:    5.5000000 0.163934426
#>  6:   19.2492245 0.204918033
#>  7:   80.0100000 0.008196721
#>  8:    6.1007812 0.098360656
#>  9:    7.6700680 0.114754098
#> 10: 4355.0100000 0.000000000

apply Monte Carlo simulation to turn ELT into YLT

ylt <- create_ylt(elt, sims=10 ,ann_rate = "rate" , event_id = "id", expval = "exp" , mu ="mean")

ylt
#>     Year         Loss Event
#>  1:    1 0.000000e+00  None
#>  2:    2 8.574328e+01     5
#>  3:    3 9.137924e-01     2
#>  4:    4 2.611786e+02     1
#>  5:    5 2.686697e+00     8
#>  6:    6 2.529234e+02     1
#>  7:    6 9.173005e+00     3
#>  8:    7 0.000000e+00  None
#>  9:    8 3.633260e-07     6
#> 10:    9 1.286863e+02     3
#> 11:    9 2.296461e+02     6
#> 12:   10 0.000000e+00  None

apply insurance structure to calculate limited losses


# Layer 500 xs 50

ylt[ , layer1_loss := layer_loss(Loss, Excess = 50 , Limit = 500  ) ] 

ylt
#>     Year         Loss Event layer1_loss
#>  1:    1 0.000000e+00  None     0.00000
#>  2:    2 8.574328e+01     5    35.74328
#>  3:    3 9.137924e-01     2     0.00000
#>  4:    4 2.611786e+02     1   211.17861
#>  5:    5 2.686697e+00     8     0.00000
#>  6:    6 2.529234e+02     1   202.92345
#>  7:    6 9.173005e+00     3     0.00000
#>  8:    7 0.000000e+00  None     0.00000
#>  9:    8 3.633260e-07     6     0.00000
#> 10:    9 1.286863e+02     3    78.68626
#> 11:    9 2.296461e+02     6   179.64615
#> 12:   10 0.000000e+00  None     0.00000

Summarise losses by year and calculated average expected loss



ann <-ylt[, lapply( .SD , sum), by=Year, .SDcols = c("Loss","layer1_loss") ] 

ann
#>     Year         Loss layer1_loss
#>  1:    1 0.000000e+00     0.00000
#>  2:    2 8.574328e+01    35.74328
#>  3:    3 9.137924e-01     0.00000
#>  4:    4 2.611786e+02   211.17861
#>  5:    5 2.686697e+00     0.00000
#>  6:    6 2.620965e+02   202.92345
#>  7:    7 0.000000e+00     0.00000
#>  8:    8 3.633260e-07     0.00000
#>  9:    9 3.583324e+02   258.33241
#> 10:   10 0.000000e+00     0.00000

expected_loss <- ann[ , lapply(.SD, mean) , .SDcols = c("Loss","layer1_loss")      ]

expected_loss
#>        Loss layer1_loss
#> 1: 97.09512    70.81777

Calculate OEP


ep <-create_oep_curve(ann , y= "Year", z="Loss")
ep
#>     return_period        OEP
#>  1:         10000 358.245795
#>  2:          5000 358.159183
#>  3:          1000 357.466284
#>  4:           500 356.600160
#>  5:           250 354.867913
#>  6:           200 354.001789
#>  7:           100 349.671171
#>  8:            50 341.009935
#>  9:            25 323.687463
#> 10:            10 271.720046
#> 11:             5 261.362178
#> 12:             2   1.800245

calculate AAL and OEP

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.