Worked Example"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

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

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

apply insurance structure to calculate limited losses

# Layer 500 xs 50

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

ylt

Summarise losses by year and calculated average expected loss

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

ann

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

expected_loss

Calculate OEP

ep <-create_oep_curve(ann , y= "Year", z="Loss")
ep

calculate AAL and OEP



Try the eltr package in your browser

Any scripts or data that you put into this service are public.

eltr documentation built on Jan. 16, 2021, 5:05 p.m.