Long Term Protection Model in R Dr. Urszula Gasser, Senior Pricing - - PowerPoint PPT Presentation

long term protection model in r
SMART_READER_LITE
LIVE PREVIEW

Long Term Protection Model in R Dr. Urszula Gasser, Senior Pricing - - PowerPoint PPT Presentation

Long Term Protection Model in R Dr. Urszula Gasser, Senior Pricing Actuary 2 Disclaimer The following presentation is for general information, education and discussion purposes only. Views or opinions expressed, whether oral or in writing do


slide-1
SLIDE 1

Long Term Protection Model in R

  • Dr. Urszula Gasser, Senior Pricing Actuary
slide-2
SLIDE 2

2

Disclaimer The following presentation is for general information, education and discussion purposes only. Views or opinions expressed, whether oral or in writing do not necessarily reflect those of PartnerRe nor do they constitute legal or professional advice.

slide-3
SLIDE 3

The need

3

slide-4
SLIDE 4

4

Life insurance Gives protection against loss resulting from death (or serious illness) of an insured

slide-5
SLIDE 5

5

Life insurance Gives protection against loss resulting from death (or serious illness) of an insured

slide-6
SLIDE 6

6

Life reinsurer needs to…

model underlying risk need for specialized tools

slide-7
SLIDE 7

The model

7

slide-8
SLIDE 8

8

What about Mr Bloggs?

healthy

slide-9
SLIDE 9

9

What about Mr Bloggs?

healthy

dead

slide-10
SLIDE 10

10

What about Mr Bloggs?

healthy

dead lapsed

slide-11
SLIDE 11

11

What about Mr Bloggs?

healthy

dead early cancer lapsed

slide-12
SLIDE 12

12

What about Mr Bloggs?

healthy

dead early cancer lapsed

slide-13
SLIDE 13

13

What about Mr Bloggs?

healthy

dead early cancer severe cancer lapsed

slide-14
SLIDE 14

14

What about Mr Bloggs?

healthy

dead early cancer severe cancer lapsed

slide-15
SLIDE 15

15

What about Mr Bloggs?

healthy

dead early cancer severe cancer early and severe cancer lapsed

slide-16
SLIDE 16

16

What about Mr Bloggs?

healthy

dead early cancer severe cancer early and severe cancer lapsed

slide-17
SLIDE 17

17

What about Mr Bloggs?

healthy

dead early cancer severe cancer early and severe cancer lapsed

qx i1

x

i2

x

qx,ix ,lx – mortality rate, incidence rate, lapse rate d – duration (months) in given state qlb1->dead

x(d)

ilb2->lb1

x(d)

qlb2->dead

x(d)

ilb1->lb2

x(d)

i1

x* i2 x

qlb1+lb2->dead

x(d)

llb1

x(d)

lh

x(d)

llb2

x(d)

llb1+lb2

x(d)

slide-18
SLIDE 18

18

And what about Mrs Bloggs?

slide-19
SLIDE 19

19

To model Mr & Mrs Bloggs policy we decided to build our own, Long Term Protection Model for pricing

slide-20
SLIDE 20

The tool

20

slide-21
SLIDE 21
  • User friendly
  • Easy to access
  • Simple to set-up
  • Fast to calculate
  • Straightforward to interpret
  • Flexible
  • Stable
  • Secure
  • Auditable

21

LTPM pricing tool needs to be

slide-22
SLIDE 22

22

We decided to do it in R as opposed to most tools used in the re/insurance industry, because these come often with:

  • Legacy issues (too heavy)
  • Calculation constraints (some things are not

possible)

  • Access issues (desktop versions, use of “workers”,

external clouds)

  • Transparency issues (black-box)
  • Maintenance issues (costly upgrade, adaptation)
slide-23
SLIDE 23

23

Why R?

  • Becoming the standard analytics tool at university

level and in many industries

  • Free
  • Open source
  • Meets our needs
  • Fast
  • Flexible
  • Reduces the number of platforms we maintain
slide-24
SLIDE 24

24

R is an excellent fit… … but we also need an infrastructure to support all the tool requirements

slide-25
SLIDE 25

The workflow

25

slide-26
SLIDE 26

26

First, let’s look at the steps in the calculation

Input data

slide-27
SLIDE 27

27

Steps in the calculation

Input data Shiny web interface

slide-28
SLIDE 28

28

Steps in the calculation

Dedicated server Input data Shiny web interface

slide-29
SLIDE 29

29

Steps in the calculation

Code repository with version control and issue tracker Dedicated server Input data Shiny web interface

slide-30
SLIDE 30

30

Steps in the calculation

Code repository with version control and issue tracker Dedicated server Input data Shiny web interface

slide-31
SLIDE 31

31

Steps in the calculation

Code repository with version control and issue tracker Dedicated server Input data Shiny web interface

slide-32
SLIDE 32

32

Steps in the calculation

Code repository with version control and issue tracker Dedicated server Input data Shiny web interface

slide-33
SLIDE 33

33

Steps in the calculation

Code repository with version control and issue tracker Dedicated server Input data Output data Shiny web interface

https://openclipart.org https://commons.wikimedia.org/wiki/File:Gnome-laptop.svg https://commons.wikimedia.org/wiki/File:Nexus_5_Front_View.png https://commons.wikimedia.org/wiki/File:Tablet-apple-ipad.svg http://www.freeiconspng.com/images/server-icon

slide-34
SLIDE 34

The interface

34

slide-35
SLIDE 35

35

slide-36
SLIDE 36

36

 web interface

slide-37
SLIDE 37

37

 web interface  collaboration

slide-38
SLIDE 38

38

 web interface  collaboration  choice of model version

slide-39
SLIDE 39

39

 web interface  collaboration  choice of model version  intuitive names

slide-40
SLIDE 40

40

 web interface  collaboration  choice of model version  intuitive names  upload of the input data

slide-41
SLIDE 41

41

slide-42
SLIDE 42

42

slide-43
SLIDE 43

43

slide-44
SLIDE 44

44

slide-45
SLIDE 45

45

slide-46
SLIDE 46

46

slide-47
SLIDE 47

47

slide-48
SLIDE 48

48

slide-49
SLIDE 49

Model code + Gitlab reference Run log file Run ZIP Input Output

49

Content of a run

slide-50
SLIDE 50

The anatomy

50

slide-51
SLIDE 51

51

GitLab repository

R packages as git submodules Shiny apps

LTPM LTPMcreate LTPMrun LTPMcalc LTPMlogging LTPMinput GitLab project

slide-52
SLIDE 52

There are two Shiny applications in the LTPM:

  • 1. LTPMcreate: the main application where pricing

exercises can be defined and runs can be created.

  • 2. LTPMrun: an interface to each individual run which

displays run details (e.g. input files and settings), status messages, and provides access to results.

52

Shiny applications

slide-53
SLIDE 53

53

GitLab repository

R packages as git submodules Shiny apps

LTPM LTPMcreate LTPMrun LTPMcalc LTPMlogging LTPMinput GitLab project

slide-54
SLIDE 54

54

GitLab repository

R packages as git submodules Shiny apps

LTPM LTPMcreate LTPMrun LTPMcalc LTPMlogging LTPMinput

slide-55
SLIDE 55

To support the calculations we have created three R extension packages:

  • 1. LTPMcalc: includes all functionality for the actual

calculations for the multi-state model.

  • 2. LTPMinput: functionality to convert user input (i.e.

spreadsheets) to an intermediate format (i.e. CSV).

  • 3. LTPMlogging: functionality to allow all scripts and

applications to log time-stamped information to the console or to a file on disk.

55

R packages

slide-56
SLIDE 56

56

GitLab repository

R packages as git submodules Shiny apps

LTPM LTPMcreate LTPMrun LTPMcalc LTPMlogging LTPMinput

slide-57
SLIDE 57

57

GitLab repository

R packages as git submodules Shiny apps

LTPM LTPMcreate LTPMrun LTPMcalc LTPMlogging LTPMinput GitLab group GitLab project

slide-58
SLIDE 58

58

Packages as git submodules – GitLab view

slide-59
SLIDE 59

59

Anatomy of LTPMrun

execute.R LTPMlogging LTPMinput LTPMcalc install.R input.R calc.R Shiny application

slide-60
SLIDE 60

The LTPMrun application has one R script to execute a full calculation run called execute.R. This script defines three execution steps, each implemented in a separate R script:

  • 1. install.R: installation of R extension packages

required by the run,

  • 2. input.R: reading and conversion of input file(s)

provided by the user,

  • 3. calc.R: perform the calculations.

60

Executable R scripts

slide-61
SLIDE 61

61

LTPMcalc The R package which implements the actual model functionality including the multi-state model. The multi-state model is a Markov chain, which is a discrete-time Markov process. Implementation details can be found in the package ‘vignette’.

slide-62
SLIDE 62

Flexibility and adaptability

62

slide-63
SLIDE 63

63

Choice of actuarial model version User can choose between:

  • the latest released version
  • past released versions
  • customized version created by themselves
  • customized version created by other user

V1.0 V2.0 V3.0 V4.0 V5.0

Master branch Branch 1 Branch 2 Tags

slide-64
SLIDE 64

64

Choice of actuarial model version

list of git tags list of git branches

slide-65
SLIDE 65

Quality assurance

65

slide-66
SLIDE 66

We can never guarantee that the model is completely free of errors and bugs. To minimize errors, we apply standard practices for quality assurance in software development:

  • 1. Many small unit tests for individual functions.
  • 2. Integration (i.e. end-to-end) tests using pre-

calculated results.

  • 3. User testing.

66

How do we ensure that the model is correct?

slide-67
SLIDE 67

67

GitLab

  • Source code version control using Git.
  • Issue tracker to track bugs and our progress in

fixing these.

  • Continuous Integration (CI) ‘pipelines’ to

automatically test –on the target system– all changes committed to the source code repository.

  • performed in target environment
  • immediate upon push
  • notifications can be send to Slack
slide-68
SLIDE 68

68

GitLab - Continuous Integration

slide-69
SLIDE 69

Questions?

69