introduction to bayesian mcmc models - home (en) · introduction to bayesian mcmc models glenn...

105
Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve Models CCL Model CSR Model CCL CSR Remarks Introduction to Bayesian MCMC Models Glenn Meyers [email protected] Presentation to 2017 ASTIN Colloquium Panama City, Panama August 23, 2017 Glenn Meyers Introduction to Bayesian MCMC Models

Upload: doankhanh

Post on 03-May-2018

246 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Introduction to Bayesian MCMC Models

Glenn Meyers

[email protected]

Presentation to 2017 ASTIN ColloquiumPanama City, Panama

August 23, 2017

Glenn Meyers Introduction to Bayesian MCMC Models

Page 2: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Outline of Workshop

1 Theory behind Bayesian Markov Chain Monte Carlo(MCMC) models

2 Bayesian MCMC in practice (Software)Introductory Examples

3 Stochastic Loss Reserve Models

Glenn Meyers Introduction to Bayesian MCMC Models

Page 3: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Objectives of Workshop

Show what Bayesian MCMC can doWatch it in actionProvide templates for software that attendees can use ormodify for their own purposes.Course materials (including R scripts) are available byemailing me at [email protected].

Glenn Meyers Introduction to Bayesian MCMC Models

Page 4: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Bayesians vs. Frequentists

Given the model X ∼ f (X |θ)Given the set of observations x .

Frequentists test the hypothesis θ = θ0.Bayesians calculate the posterior distribution f (θ|x).

f (θ|x) = f (x |θ) · π(θ)∫ϑ

f (x |ϑ) · π(ϑ) · dϑ

The issue — What is the prior distribution, π(θ)?

Glenn Meyers Introduction to Bayesian MCMC Models

Page 5: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Philosophical Issue

Bayesians select π “subjectively” according to prioropinion.Frequentists respond by saying that conclusions should bedictated solely by looking at “the data.”Bayesians respond with “noninformative” priors.

Is there such a thing?

Glenn Meyers Introduction to Bayesian MCMC Models

Page 6: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Practical Issue — Can we do the calculations?

For most of the 20th century, the frequentists werewinning.

Calculations were easy with quadradic forms needed for thenormal distributions.The General Linear Model (PROC GLM in SAS).As computers and numerical analysis progressed we gotthe Generalized Linear Model (PROC GENMOD in SAS).

Now the Bayesians are winning - with MCMC.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 7: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Problem with Bayesian Analysis

Let θ be an n-parameter vector — e.g. developmentfactors.Let X be a set of observations — e.g. a loss triangle.

f (θ|x) = f (x |θ) · π(θ)∫ϑ1

· · ·∫ϑn

f (x |ϑ) · π(ϑ) · dϑ

f (X |θ) is the likelihood of X given θ.π(θ) is the prior distribution of θ.f (θ|X ) is the posterior distribution of θ.

Calculating the n-dimensional integral is intractable.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 8: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Problem with Bayesian Analysis

Let θ be an n-parameter vector — e.g. developmentfactors.Let X be a set of observations — e.g. a loss triangle.

f (θ|x) = f (x |θ) · π(θ)∫ϑ1

· · ·∫ϑn

f (x |ϑ) · π(ϑ) · dϑ

f (X |θ) is the likelihood of X given θ.π(θ) is the prior distribution of θ.f (θ|X ) is the posterior distribution of θ.Calculating the n-dimensional integral is intractable.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 9: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

A New World Order

This impasse came to an end in 1990 when asimulation-based approach to estimating posteriorprobabilities was introduced.Sampling Based Approach to Calculating MarginalDensities

Alan E. Gelfand and Adrian F.M. SmithJournal of the American Statistical Association, June 1990

Glenn Meyers Introduction to Bayesian MCMC Models

Page 10: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Markov Chains

Let Ω be a finite state with random events

X1,X2, . . . ,Xt , . . .

A Markov chain P satisfies

Pr(Xt = y |Xt−1 = xt−1, . . . ,X1 = x1) = Pr(Xt = y |Xt−1 = xt−1)

The probability of an event in the chain depends only onthe immediate previous event.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 11: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Markov Convergence Theorem

There is a branch of probability theory, called ErgodicTheory, that gives conditions for which there exists aunique stationary distribution, π, such that

Pr(y |Xt−1) −→ π(y)

as t −→∞

Glenn Meyers Introduction to Bayesian MCMC Models

Page 12: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Metropolis Hastings AlgorithmA Very Important Markov Chain.

1 Time t = 1: select a random initial position θ1 inparameter space.

2 Select a proposal distribution p(θ|θt−1) that we will use toselect proposed random steps away from our currentposition in parameter space.

3 Starting at time t = 2: repeat the following until you getconvergence:

At step t, generate a proposal θ∗ ∼ p(θ|θt−1).Generate U ∼ uniform(0,1)Calculate

R = f (θ∗|x)f (θt−1|x) ·

p(θt−1|θ∗)p(θ∗|θt−1)

If U < R then θt = θ∗. Else, θt = θt−1.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 13: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Dodging the Intractable Integral

R = f (θ∗|x)f (θt−1|x) ·

p(θt−1|θ∗)p(θ∗|θt−1)

R =

f (x |θ∗)·π(θ∗)∫ϑ1

···∫

ϑn

f (x |ϑ)·π(ϑ)·dϑ

f (x |θt−1)·π(θt−1)∫ϑ1

···∫

ϑn

f (x |ϑ)·π(ϑ)·dϑ

· p(θt−1|θ∗)p(θ∗|θt−1)

The integral∫ϑ1

· · ·∫ϑn

f (x |ϑ) · π(ϑ) · dϑ cancels out!

Glenn Meyers Introduction to Bayesian MCMC Models

Page 14: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Metropolis Hastings Algorithm Restated

1 Time t = 1: select a random initial position θ1 inparameter space.

2 Select a proposal distribution p(θ|θt−1) that we will use toselect proposed random steps away from our currentposition in parameter space.

3 Starting at time t = 2: repeat the following until you getconvergence:

At step t, generate a proposal θ∗ ∼ p(θ|θt−1).Generate U ∼ uniform(0,1)Calculate

R = f (x |θ∗) · π(θ∗)f (x |θt−1) · π(θt−1) ·

p(θt−1|θ∗)p(θ∗|θt−1)

If U < R then θt = θ∗. Else, θt = θt−1.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 15: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Relevance of theMetropolis Hastings Algorithm

Defined in terms of the conditional distribution

f (X |θ)

and the prior distribution

π(θ)The limiting distribution is the posterior distribution!

Code f (X |θ) and π(θ) into a Markov chain and let it runfor a while, and you have a large sample from the posteriordistribution.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 16: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Relevance of theMetropolis Hastings Algorithm

Defined in terms of the conditional distribution

f (X |θ)

and the prior distribution

π(θ)The limiting distribution is the posterior distribution!Code f (X |θ) and π(θ) into a Markov chain and let it runfor a while, and you have a large sample from the posteriordistribution.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 17: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Relevance of theMetropolis Hastings Algorithm

The theoretical limiting distribution is the same, no matterwhat proposal distribution, p(θ|θt−1), is used.There is no fundamental limit on the number ofparameters in you model!The practical limit is within range of stochastic lossreserve models.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 18: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

A Short History of MCMC

Originated with the study of nuclear fission.Enrico Fermi, John von Neumann, Nicolas Metropolis andStanislaw Ulam.Developed the Metropolis algorithm.

Keith Hastings (1970) recognized the potential of theMetropolis algorithm to solve statistical problems.Simulations were not readily accepted by the statisticalcommunity at that time.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 19: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

A Short History of MCMC

Gelfand and Smith (1990) pulled together the relevantideas at a time when simulation was deemed OK.

Seized upon by scientists in other fields.Used the Gibbs sampler (A one parameter at a time specialcase of Metropolis Hastings algorithm).

Statisticians in the UK started the BUGS project toproduce software for MCMC.

Bayesian inference Using the Gibbs Sampler

Glenn Meyers Introduction to Bayesian MCMC Models

Page 20: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Evolution of MCMC Software

WinBUGS (Original — now discontinued)OpenBUGS (Continuation of WinBUGS)

Designed mainly for the Windows operating system.JAGS — Just Another Gibbs Sampler

Originated by Martyn Plummer.Runs on multiple operating systems.Callable from R (“runjags” package.)

Stan (in honor of Stanislaw Ulam)Stan team led by Andrew Gelman at Columbia University.Runs on multiple operation systems.Callable from R (“rstan” package) and other languages,e.g. Python and Matlab.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 21: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Illustrate Adaptation and Convergence withLognormal Example

Given the data below, estimate the cost of a 15,000 xs of10,000 layer.Find predictive distribution of losses in that layer.Fit a lognormal distribution with

log(mean) = µlog(standard deviation) = 1

484 603 631 1189 12291407 1565 1894 2140 22442262 2654 2672 4019 43185015 5354 5464 5598 60606500 6747 9143 12782 18349

Glenn Meyers Introduction to Bayesian MCMC Models

Page 22: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Lessons from the Example

Open “MH Intro with Lognormal.R”Adaptation — Scaling the proposal distribution with σpropto get a representative sample in as few iterations aspossible.

µi ∼ normal(µi−1, σprop)

Convergence — Running multiple chains and comparingresults.Thinning — When adaption does not work well, takeevery nth iteration for sufficiently large n. Takes time.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 23: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Lessons from the Example

Open “MH Intro with Lognormal.R”Adaptation — Scaling the proposal distribution with σpropto get a representative sample in as few iterations aspossible.

µi ∼ normal(µi−1, σprop)

Convergence — Running multiple chains and comparingresults.

Thinning — When adaption does not work well, takeevery nth iteration for sufficiently large n. Takes time.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 24: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Lessons from the Example

Open “MH Intro with Lognormal.R”Adaptation — Scaling the proposal distribution with σpropto get a representative sample in as few iterations aspossible.

µi ∼ normal(µi−1, σprop)

Convergence — Running multiple chains and comparingresults.Thinning — When adaption does not work well, takeevery nth iteration for sufficiently large n. Takes time.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 25: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Adaptation in One Dimension is Easy

Trial and error works.If there are many dimensions, say 30 or 1000, some mathis required.The software (e.g. JAGS or Stan) does the math.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 26: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Computing Environment for Workshop Examples

Downloadable SoftwareR at http://www.r-project.org/RStudio at http://www.rstudio.com/rstan at http://mc-stan.org

R packages“rstan” and “loo”

Stan is a language separate from R.Stan language put in a character string in R.The command ”stan” from the ”rstan” package calls thestring.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 27: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

An Introductory Example Using Stan

Simulate 500 observations from a gamma distribution.

f (y |α, β) = βα · yα−1 · eβ·yΓ(α)

Introduce a covariate, x .

β = 1 + x , x ∈ (0, 1)

Fit a model f (y |α, β0 + β1 · x).Prior distribution

α ∼ f (α|1, 1), β0 ∼ f (β0|1, 1), β1 ∼ f (β1|1, 1)

Glenn Meyers Introduction to Bayesian MCMC Models

Page 28: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

An Introductory Example Using Stan

Simulate 500 observations from a gamma distribution.

f (y |α, β) = βα · yα−1 · eβ·yΓ(α)

Introduce a covariate, x .

β = 1 + x , x ∈ (0, 1)

Fit a model f (y |α, β0 + β1 · x).Prior distribution

α ∼ f (α|1, 1), β0 ∼ f (β0|1, 1), β1 ∼ f (β1|1, 1)

Glenn Meyers Introduction to Bayesian MCMC Models

Page 29: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Structure of stan Script

R script file is “StanIntro.R”Required block - “data”Required block - “parameters”Optional block - “transformed parameters”Required block - “model”Optional block - “generated quantities”

Glenn Meyers Introduction to Bayesian MCMC Models

Page 30: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Calling stan in R

Run four chainsFaster if run in parallel. Requires some setup toward thetop of the script.Test convergence. Trace plots of chains should beindistinguishable. More on that below.

Need to set a list for input data.Need an initialization function.Specify number of iterations, etc, etc.

Now run the “StanIntro.R” script.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 31: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Calling stan in R

Run four chainsFaster if run in parallel. Requires some setup toward thetop of the script.Test convergence. Trace plots of chains should beindistinguishable. More on that below.

Need to set a list for input data.Need an initialization function.Specify number of iterations, etc, etc.Now run the “StanIntro.R” script.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 32: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Testing for Convergence of the Markov Chain

Trace plots of parameters show rapid convergence.Gelman-Rubin Convergence Diagnostic

Let W = Within Chain VarianceLet B = Between Chain VarianceDefine “Potential Scale Reduction Factor” (PSRF) orR-Hat by: √

R =

√W + B

W−→ 1

Gelman and Rubin suggest that we should acceptconvergence if R-Hat < 1.1

All R-Hat statistics are less than 1.01 for “StanIntro.R”

Glenn Meyers Introduction to Bayesian MCMC Models

Page 33: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Model Selection With the “loo” Package”

Given two different models for the same data, how do youselect the “better” model?

“loo” stands for Leave One Out.Maintained by members of the stan development team.Vehtari, A., Gelman, A., and Gabry, J. (2015). “Efficientimplementation of leave-one-out cross validation andWAIC for evaluating fitted Bayesian models.”See the documentation of the “loo” package for the latestversion of the paper.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 34: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Model Selection With the “loo” Package”

Given two different models for the same data, how do youselect the “better” model?“loo” stands for Leave One Out.Maintained by members of the stan development team.Vehtari, A., Gelman, A., and Gabry, J. (2015). “Efficientimplementation of leave-one-out cross validation andWAIC for evaluating fitted Bayesian models.”See the documentation of the “loo” package for the latestversion of the paper.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 35: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Selecting Models Fit By Maximum Likelihood

If we fit a model, f (x |θ), by maximum likelihood, define

AIC = 2 · p − 2 · L(x |θ)

Where:p is the number of parameters in the model.L(x |θ) is the maximum log-likelihood of the modelspecified by f .

Lower AIC indicates a better fit.Encourages a larger log-likelihood.Penalizes an increase in the number of parameters.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 36: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Selecting Bayesian MCMC Modelswith the LOOIC Statistic

Given an MCMC model with parameters θi10,000i=1 , define

LOOIC = 2 · pLOOIC − 2 · L(x |θi )10,000i=1

WherepLOOIC is the effective number of parameters.

pLOOIC = L(x |θi )10,000i=1 −

N∑n=1L(xn|x(−n), θi )

10,000i=1

x(−n) = x1, . . . , xn−1, xn+1, . . . , xNL(xn|x(−n), θi ) is the log-likelihood of xn from a model fitusing all data except xn.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 37: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Selecting Bayesian MCMC Modelswith the LOOIC Statistic

After some algebra we can see that

LOOIC = −2 ·N∑

n=1L(xn|x(−n), θi )

10,000i=1

which we like as it favors the model with the largestlikelihood, and the smallest LOOIC, on the “holdout” data.

Some “loo” package features.∑Nn=1 L(xn|x(−n), θi )

10,000i=1 ≡ ELPDLOO

“loo” does not calculate each summand in ELPDLOO byMCMC. Instead it approximates the sum using a10,000 x N matrix of log-likelihoods.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 38: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Selecting Bayesian MCMC Modelswith the LOOIC Statistic

After some algebra we can see that

LOOIC = −2 ·N∑

n=1L(xn|x(−n), θi )

10,000i=1

which we like as it favors the model with the largestlikelihood, and the smallest LOOIC, on the “holdout” data.Some “loo” package features.∑N

n=1 L(xn|x(−n), θi )10,000i=1 ≡ ELPDLOO

“loo” does not calculate each summand in ELPDLOO byMCMC. Instead it approximates the sum using a10,000 x N matrix of log-likelihoods.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 39: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Examples Illustrating the LOOIC

“StanIntro.R” model - y ∼ gamma(α, β0 + β1 · x)

Estimate SEELPDLOO -294.59 22.90pLOO 2.82 0.29LOOIC 589.19 45.79

“StanIntro 2.R” model - y ∼ gamma(α, β)

Estimate SEELPDLOO -307.41 23.27pLOO 2.12 0.25LOOIC 614.83 46.54

The model y ∼ gamma(α, β0 + β1 · x) is “better.”

Glenn Meyers Introduction to Bayesian MCMC Models

Page 40: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Examples Illustrating the LOOIC

“StanIntro.R” model - y ∼ gamma(α, β0 + β1 · x)

Estimate SEELPDLOO -294.59 22.90pLOO 2.82 0.29LOOIC 589.19 45.79

“StanIntro 2.R” model - y ∼ gamma(α, β)

Estimate SEELPDLOO -307.41 23.27pLOO 2.12 0.25LOOIC 614.83 46.54

The model y ∼ gamma(α, β0 + β1 · x) is “better.”

Glenn Meyers Introduction to Bayesian MCMC Models

Page 41: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Overlapping Predictors

Run “StanIntro 3.R” - y ∼ gamma(α, β01 · β02 + β1 · x)

Note the hyperbolic shape of the β01, β02 plot.I was trying to construct a slowly converging example.The stan adaptation algorithm works very well.Good and bad newsThe Folk Theorem of Statistical Computing

Computational problems are often model problems indisguise.

One sign of “computational problems” is divergenttransitions. Stan will warn you when they occur. There isnot enough time to discuss them here.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 42: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Overlapping Predictors

Run “StanIntro 3.R” - y ∼ gamma(α, β01 · β02 + β1 · x)Note the hyperbolic shape of the β01, β02 plot.

I was trying to construct a slowly converging example.The stan adaptation algorithm works very well.Good and bad newsThe Folk Theorem of Statistical Computing

Computational problems are often model problems indisguise.

One sign of “computational problems” is divergenttransitions. Stan will warn you when they occur. There isnot enough time to discuss them here.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 43: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Overlapping Predictors

Run “StanIntro 3.R” - y ∼ gamma(α, β01 · β02 + β1 · x)Note the hyperbolic shape of the β01, β02 plot.I was trying to construct a slowly converging example.

The stan adaptation algorithm works very well.Good and bad newsThe Folk Theorem of Statistical Computing

Computational problems are often model problems indisguise.

One sign of “computational problems” is divergenttransitions. Stan will warn you when they occur. There isnot enough time to discuss them here.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 44: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Overlapping Predictors

Run “StanIntro 3.R” - y ∼ gamma(α, β01 · β02 + β1 · x)Note the hyperbolic shape of the β01, β02 plot.I was trying to construct a slowly converging example.The stan adaptation algorithm works very well.Good and bad news

The Folk Theorem of Statistical ComputingComputational problems are often model problems indisguise.

One sign of “computational problems” is divergenttransitions. Stan will warn you when they occur. There isnot enough time to discuss them here.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 45: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Overlapping Predictors

Run “StanIntro 3.R” - y ∼ gamma(α, β01 · β02 + β1 · x)Note the hyperbolic shape of the β01, β02 plot.I was trying to construct a slowly converging example.The stan adaptation algorithm works very well.Good and bad newsThe Folk Theorem of Statistical Computing

Computational problems are often model problems indisguise.

One sign of “computational problems” is divergenttransitions. Stan will warn you when they occur. There isnot enough time to discuss them here.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 46: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Stochastic Loss Reserving Examples

My initial paper on the subject of stochastic loss reservingwas “Estimating Predictive Distributions for Loss ReserveModels” Variance 2007http://www.variancejournal.org/issues/?fa=article&abstrID=6417

Two features of that paperIt was very primitive Bayesian.It included (what I call) “aggressive backtesting.”

Like many others (e.g. Scollnik (2001), De Alba (2002)and Verrall (2007)) - I saw Bayesian MCMC as apromising tool for stochastic loss reserving.But it was the availability of good data for backtestingthat drew me into the game.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 47: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Stochastic Loss Reserving Examples

My initial paper on the subject of stochastic loss reservingwas “Estimating Predictive Distributions for Loss ReserveModels” Variance 2007http://www.variancejournal.org/issues/?fa=article&abstrID=6417

Two features of that paperIt was very primitive Bayesian.It included (what I call) “aggressive backtesting.”

Like many others (e.g. Scollnik (2001), De Alba (2002)and Verrall (2007)) - I saw Bayesian MCMC as apromising tool for stochastic loss reserving.But it was the availability of good data for backtestingthat drew me into the game.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 48: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The CAS Loss Reserve Database

The National Association of Insurance Commissioners(NAIC) gave the University of Wisconsin free access totheir database for academic studies.Jed Frees and I were involved in a joint project with theAustralian Institute of Actuaries to study dependenciesbetween lines of business. One of Jed’s graduate studentsat the time, Peng Shi, assembled the database from theNAIC Schedule P data.I (with the help of the CAS) requested to make the dataavailable on the CAS web site. It was granted by TerriVaughan, the then president of the NAIC and CASmember. The link to the database is below.

http://www.casact.org/research/index.cfm?fa=loss_reserves_data

Glenn Meyers Introduction to Bayesian MCMC Models

Page 49: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Schedule P Data for Incurred Losses

Table: Illustrative Insurer Net Written PremiumAY 1 2 3 4 5 6 7 8 9 10

Premium 5812 4908 5454 5165 5214 5230 4992 5466 5226 4962

Table: Illustrative Insurer Incurred Losses Net of ReinsuranceAY \ Lag 1 2 3 4 5 6 7 8 9 10 Source

1988 1722 3830 3603 3835 3873 3895 3918 3918 3917 3917 19971989 1581 2192 2528 2533 2528 2530 2534 2541 2538 2532 19981990 1834 3009 3488 4000 4105 4087 4112 4170 4271 4279 19991991 2305 3473 3713 4018 4295 4334 4343 4340 4342 4341 20001992 1832 2625 3086 3493 3521 3563 3542 3541 3541 3587 20011993 2289 3160 3154 3204 3190 3206 3351 3289 3267 3268 20021994 2881 4254 4841 5176 5551 5689 5683 5688 5684 5684 20031995 2489 2956 3382 3755 4148 4123 4126 4127 4128 4128 20041996 2541 3307 3789 3973 4031 4157 4143 4142 4144 4144 20051997 2203 2934 3608 3977 4040 4121 4147 4155 4183 4181 2006

Insurer 353 - Commercial Auto

Glenn Meyers Introduction to Bayesian MCMC Models

Page 50: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Schedule P Data for Paid Losses

Table: Illustrative Insurer Net Written PremiumAY 1 2 3 4 5 6 7 8 9 10

Premium 5812 4908 5454 5165 5214 5230 4992 5466 5226 4962

Table: Illustrative Insurer Paid Losses Net of ReinsuranceAY \ Lag 1 2 3 4 5 6 7 8 9 10 Source

1988 952 1529 2813 3647 3724 3832 3899 3907 3911 3912 19971989 849 1564 2202 2432 2468 2487 2513 2526 2531 2527 19981990 983 2211 2830 3832 4039 4065 4102 4155 4268 4274 19991991 1657 2685 3169 3600 3900 4320 4332 4338 4341 4341 20001992 932 1940 2626 3332 3368 3491 3531 3540 3540 3583 20011993 1162 2402 2799 2996 3034 3042 3230 3238 3241 3268 20021994 1478 2980 3945 4714 5462 5680 5682 5683 5684 5684 20031995 1240 2080 2607 3080 3678 2004 4117 4125 4128 4128 19971996 1326 2412 3367 3843 3965 4127 4133 4141 4142 4144 20051997 1413 2683 3173 3674 3805 4005 4020 4095 4132 4139 2006

Insurer 353 - Commercial Auto

Glenn Meyers Introduction to Bayesian MCMC Models

Page 51: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Made use of the database in my monograph

The url for the monographhttp://www.casact.org/pubs/monographs/index.cfm?fa=meyers-monograph01

Analyzed 50 insurers in each of four lines of insurance.Backtested the Mack model with the R “ChainLadder”package on incurred data and found that it understatedthe variability of the lower triangle holdout data.Backtested the Mack and ODP Bootstrap model with theR “ChainLadder” package on paid data and found that ittended to overstate the losses in the lower triangle holdoutdata.Proposed new models that improve the performance onthe lower triangle holdout data.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 52: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Models Presented in this Workshop

A current version of the “Correlated Chain Ladder” (CCL)model on cumulative incurred triangle data.

Allowing for correlations between accident years canincrease the variability of the predictive distribution.

A current version of the “Changing Settlement Rate”(CSR) model on cumulative paid triangle data.

Allows for a gradual shift in the payout pattern to accountfor a change in the claim settlement rate.

A model that simultaneously fits both the paid andincurred data with the CCL and CSR models.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 53: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Correlated Chain Ladder (CCL) Model

Let C Iwd be the cumulative incurred loss for a 10 x 10

triangle for accident year w and development year d .Let Pw be the earned premium for accident year w .Let αw ∼ Normal(0,

√10) for w = 2, . . . , 10. Set α1 ≡ 0.

Let βId ∼ Normal(0,

√10) for d = 1, . . . , 9. Set βI

10 ≡ 0.Let logelr ∼ Normal(0,

√10).

Let ρ ∼ β(2, 2) scaled to go between -1 and 1, whereβ(., .) denotes the β distribution.Let aI

i ∼ Uniform(0, 1) for d = 1, . . . , 10. Then set(σI

d )2 =∑10

i=daI

i . This forces σI1 < σI

2 < . . . < σI10.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 54: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Continuing with the CCL Model

Set µI1d = log(P1) + logelr + βI

d for d = 1, . . . , 10.Set µI

wd =log(Pw ) + logelr + αw + βI

d + ρ · (log(C Iw−1,d )− µI

w−1,d )for w = 2, . . . , 10 and d = 1, . . . , 11− w .Then C I

wd ∼ lognormal(µIwd , σ

Id ).

Glenn Meyers Introduction to Bayesian MCMC Models

Page 55: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Outline of the “CCL.R” Script

1 Read in data from the CAS Loss Reserve Database.”2 Compile the stan script with dummy data. This saves time

when you are fitting several triangles in the script.3 Create a function that fits the model.

Call the stan function that outputs a sample of theparameters.Turn the parameters into predicted outcomes by takingrandom draws from a lognormal distribution with log-meanµI

w ,10 and log-standard deviation σIw ,10 for w = 1, . . . , 10.

Makes use of the “parallel” and “doparallel” packages.Calculate statistics of interest, e.g. Overall Estimate,LOOIC, percentile of the outcome.

4 Call the model fitting function for a triangle, or a list oftriangles.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 56: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CCL.R”

Run Insurer 353 - CA - Explore output.

Does the inclusion of the ρ parameter improve the modelfit?LOOIC(CA 353) for CCL = -138.3LOOIC(CA 353) for CCL(−ρ) = -142.8 (Lower!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 57: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CCL.R”

Run Insurer 353 - CA - Explore output.Does the inclusion of the ρ parameter improve the modelfit?LOOIC(CA 353) for CCL = -138.3

LOOIC(CA 353) for CCL(−ρ) = -142.8 (Lower!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 58: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CCL.R”

Run Insurer 353 - CA - Explore output.Does the inclusion of the ρ parameter improve the modelfit?LOOIC(CA 353) for CCL = -138.3LOOIC(CA 353) for CCL(−ρ) = -142.8 (Lower!)

Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 59: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CCL.R”

Run Insurer 353 - CA - Explore output.Does the inclusion of the ρ parameter improve the modelfit?LOOIC(CA 353) for CCL = -138.3LOOIC(CA 353) for CCL(−ρ) = -142.8 (Lower!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 60: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Distribution of the Mean of ρ for the CCL Model

Glenn Meyers Introduction to Bayesian MCMC Models

Page 61: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Distribution of LOOICCCL − LOOICCCL(−ρ)Negative difference favors CCL

Glenn Meyers Introduction to Bayesian MCMC Models

Page 62: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Meta-Testing Percentiles of Outcomes with theLower Triangle Holdout Data.

Use the model to calculate the percentile of the predictivedistribution of the actual outcome.We should expect the percentiles of the outcomes to beuniformly distributed.Uniformity is testable with model fits and outcomes ofseveral insurers.

PP Plots - Plot the sorted values of a uniformly distributedset of numbers, Expected, against the sorted percentiles ofthe outcomes predicted by the model, Predicted.

We expect the plot to lie along a 45o line.Kolmogorov-Smirnov test puts bounds around how far thedifference between the predicted and expected can be.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 63: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Meta-Testing Percentiles of Outcomes with theLower Triangle Holdout Data.

Use the model to calculate the percentile of the predictivedistribution of the actual outcome.We should expect the percentiles of the outcomes to beuniformly distributed.Uniformity is testable with model fits and outcomes ofseveral insurers.PP Plots - Plot the sorted values of a uniformly distributedset of numbers, Expected, against the sorted percentiles ofthe outcomes predicted by the model, Predicted.

We expect the plot to lie along a 45o line.Kolmogorov-Smirnov test puts bounds around how far thedifference between the predicted and expected can be.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 64: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

PP Plot Characteristics

Glenn Meyers Introduction to Bayesian MCMC Models

Page 65: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

PP Plot Characteristics

Glenn Meyers Introduction to Bayesian MCMC Models

Page 66: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Mack Model on Incurred Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 67: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CCL(−ρ) Model on Incurred Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 68: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CCL Model on Incurred Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 69: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Discussion Points for CCL Model

Posterior means of ρ exhibit a strong positive tendency.In relatively few of the insurers does the CCL improve thefit as measured by the LOOIC.Does the meta-analysis indicate a superior fit?How should the results of the meta-analysis affect anindividual insurer’s choice of a model?

Glenn Meyers Introduction to Bayesian MCMC Models

Page 70: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Changing Settlement Rate (CSR) Model

Let CPwd be the cumulative paid loss for a 10 x 10 triangle

for accident year w and development year d .Let Pw be the earned premium for accident year w .Let αw ∼ Normal(0,

√10) for w = 2, . . . , 10. Set α1 ≡ 0.

Let βPd ∼ Normal(0,

√10) for d = 1, . . . , 9. Set βP

10 ≡ 0.Let logelr ∼ Normal(0,

√10).

Let γ ∼ Normal(0, 0.05).Let aP

i ∼ Uniform(0, 1) for d = 1, . . . , 10. Then set(σP

d )2 =∑10

i=daP

i . This forces σP1 < σP

2 < . . . < σP10.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 71: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Continuing with the CSR Model.

Set µPwd = log(Pw ) + logelr + αw + βp

d · (1− γ)w−1 forw = 1, . . . , 10 and d = 1, . . . , 11− w .Then CP

wd ∼ lognormal(µPwd , σ

Pd ).

A positive γ moves the development year componentcloser to zero with each accident year.Hence a speedup of claim settlement.If γ is negative, the claim settlement slows down.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 72: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Continuing with the CSR Model.

Set µPwd = log(Pw ) + logelr + αw + βp

d · (1− γ)w−1 forw = 1, . . . , 10 and d = 1, . . . , 11− w .Then CP

wd ∼ lognormal(µPwd , σ

Pd ).

A positive γ moves the development year componentcloser to zero with each accident year.Hence a speedup of claim settlement.If γ is negative, the claim settlement slows down.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 73: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CSR.R”

Run Insurer 353 - CA - Explore output.

Does the inclusion of the γ parameter improve the modelfit?LOOIC(CA 353) for CSR = -99.9LOOIC(CA 353) for CSR(−γ) = -97.4 (Higher!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 74: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CSR.R”

Run Insurer 353 - CA - Explore output.Does the inclusion of the γ parameter improve the modelfit?LOOIC(CA 353) for CSR = -99.9

LOOIC(CA 353) for CSR(−γ) = -97.4 (Higher!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 75: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Running “CSR.R”

Run Insurer 353 - CA - Explore output.Does the inclusion of the γ parameter improve the modelfit?LOOIC(CA 353) for CSR = -99.9LOOIC(CA 353) for CSR(−γ) = -97.4 (Higher!)Let’s look at other insurers.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 76: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Glenn Meyers Introduction to Bayesian MCMC Models

Page 77: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Distribution of LOOICCSR − LOOICCSR(−γ)Negative difference favors CSR

Glenn Meyers Introduction to Bayesian MCMC Models

Page 78: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Mack Model on Paid Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 79: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CSR(−γ) Model on Paid Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 80: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CSR Model on Paid Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 81: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Discussion Points for the CSR Model

Posterior means of γ are mixed. Most are positive,indicating a speedup of claim settlement rates.But many speedup rates are either close to zero, ornegative.When the speedup rate is close to zero, we should expectthe CSR(−γ) to have a better fit, as measured by theLOOIC.

Why do we get more occurrences of better fits with theCSR Model?When looking at the PP plots for CSR and CCL models,we see a noticeably larger difference betweenCSR and CSR(−γ) than we do with CCL and CCL(−ρ).

Glenn Meyers Introduction to Bayesian MCMC Models

Page 82: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Discussion Points for the CSR Model

Posterior means of γ are mixed. Most are positive,indicating a speedup of claim settlement rates.But many speedup rates are either close to zero, ornegative.When the speedup rate is close to zero, we should expectthe CSR(−γ) to have a better fit, as measured by theLOOIC.Why do we get more occurrences of better fits with theCSR Model?When looking at the PP plots for CSR and CCL models,we see a noticeably larger difference betweenCSR and CSR(−γ) than we do with CCL and CCL(−ρ).

Glenn Meyers Introduction to Bayesian MCMC Models

Page 83: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Some Intricacies of stan

The model block R/stan script “StanIntro.R” reads:

model alpha ∼ gamma(1,1);beta ∼ gamma(1,1);y ∼ gamma(alpha,beta);

What these sampling statements do is increment (add to)the log-likelihood of the parameters (or data) to a hiddenvariable called “target.”

Glenn Meyers Introduction to Bayesian MCMC Models

Page 84: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Some Intricacies of stan

Here is something you could do.

model alpha ∼ gamma(1,1);beta 1 ∼ gamma(1,1);beta 2 ∼ gamma(1,1);y 1 ∼ gamma(alpha,beta 1);y 2 ∼ gamma(alpha,beta 2);

The log-likelihoods of y 1 and y 2 are added successivelyto “target.”What this does is fit two models to the data y 1 andy 2 with separate rate parameters β 1 and β 2 andcommon shape parameter α.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 85: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Apply this idea to the CCL and CSR Models

Look at accident year (level) parameterslogelr - Should be the same if we have a long enoughdevelopment period.The paid and incurred should be close after 10 years.

logelr I ∼ normal(logelrP , 0.05)

Provisionally assume that the αw parameters are the same.Else why bother?

The βd , γ and ρ will differ for paid and incurred losses.

I want to credit Ned Tyrrell, FCAS, who suggested thisintegrated approach to me.Run the “CCL CSR.R” script.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 86: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Apply this idea to the CCL and CSR Models

Look at accident year (level) parameterslogelr - Should be the same if we have a long enoughdevelopment period.The paid and incurred should be close after 10 years.

logelr I ∼ normal(logelrP , 0.05)

Provisionally assume that the αw parameters are the same.Else why bother?

The βd , γ and ρ will differ for paid and incurred losses.I want to credit Ned Tyrrell, FCAS, who suggested thisintegrated approach to me.

Run the “CCL CSR.R” script.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 87: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Apply this idea to the CCL and CSR Models

Look at accident year (level) parameterslogelr - Should be the same if we have a long enoughdevelopment period.The paid and incurred should be close after 10 years.

logelr I ∼ normal(logelrP , 0.05)

Provisionally assume that the αw parameters are the same.Else why bother?

The βd , γ and ρ will differ for paid and incurred losses.I want to credit Ned Tyrrell, FCAS, who suggested thisintegrated approach to me.Run the “CCL CSR.R” script.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 88: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

IP-CCL PP Plots

Glenn Meyers Introduction to Bayesian MCMC Models

Page 89: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Compare with Standalone CCL PP Plots

Glenn Meyers Introduction to Bayesian MCMC Models

Page 90: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

IP-CSR PP Plots

Glenn Meyers Introduction to Bayesian MCMC Models

Page 91: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Compare with Standalone CSR PP Plots

Glenn Meyers Introduction to Bayesian MCMC Models

Page 92: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Comparing Combined IP and Standalone Models

For CA and OL, both the combined and standalone modelare comfortably with the KS bounds. So is PA for the CCLmodel.For the CSR model - PA, the combined model is justwithin the KS bounds for the combined model, andoutside the KS bounds for the standalone model.

What is the difference between WC and the other lines?Run the combined model on Insurer 86 with WC.Big difference between paid and incurred losses at d = 10for WC. Not so for the other lines.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 93: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Comparing Combined IP and Standalone Models

For CA and OL, both the combined and standalone modelare comfortably with the KS bounds. So is PA for the CCLmodel.For the CSR model - PA, the combined model is justwithin the KS bounds for the combined model, andoutside the KS bounds for the standalone model.What is the difference between WC and the other lines?Run the combined model on Insurer 86 with WC.

Big difference between paid and incurred losses at d = 10for WC. Not so for the other lines.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 94: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Comparing Combined IP and Standalone Models

For CA and OL, both the combined and standalone modelare comfortably with the KS bounds. So is PA for the CCLmodel.For the CSR model - PA, the combined model is justwithin the KS bounds for the combined model, andoutside the KS bounds for the standalone model.What is the difference between WC and the other lines?Run the combined model on Insurer 86 with WC.Big difference between paid and incurred losses at d = 10for WC. Not so for the other lines.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 95: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Common αw parameters are not good for WC

Glenn Meyers Introduction to Bayesian MCMC Models

Page 96: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Compare Results for Combined and StandaloneModels on the Illustrative Insurer

Standalone CCL for CA #353Estimate = 39,158, SE = 1,775

Combined CCLEstimate = 38,806, SE = 1,264

Standalone CSREstimate = 37,483, SE = 2,335

Combined CSREstimate = 38,746, SE = 1,353

Note the significant reduction in the SEs for the CombinedModel!For CA, PA and OL, we get good performance on thelower triangle holdout data for both the combined andstandalone models.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 97: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Compare Results for Combined and StandaloneModels on the Illustrative Insurer

Standalone CCL for CA #353Estimate = 39,158, SE = 1,775

Combined CCLEstimate = 38,806, SE = 1,264

Standalone CSREstimate = 37,483, SE = 2,335

Combined CSREstimate = 38,746, SE = 1,353

Note the significant reduction in the SEs for the CombinedModel!For CA, PA and OL, we get good performance on thelower triangle holdout data for both the combined andstandalone models.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 98: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CCL log(SE) Comparisons for all 200 Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 99: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

CSR log(SE) Comparisons for all 200 Triangles

Glenn Meyers Introduction to Bayesian MCMC Models

Page 100: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Quest for a Minimum Variance Estimator

Ned Tyrrell pulled me into combined models to get moreaccurate, i.e. less variability in the, estimates of the lossreserve liability.Ned’s objective appears to have been met for CA, PA andOL.

My suggestions for using combined models1 Fit standalone CCL and CSR models.2 Compare αw parameters.3 If the above parameters are sufficiently close, fit a

combined CCL and CSR model.Or any other paid and incurred model that you deemappropriate.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 101: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Quest for a Minimum Variance Estimator

Ned Tyrrell pulled me into combined models to get moreaccurate, i.e. less variability in the, estimates of the lossreserve liability.Ned’s objective appears to have been met for CA, PA andOL.My suggestions for using combined models

1 Fit standalone CCL and CSR models.2 Compare αw parameters.3 If the above parameters are sufficiently close, fit a

combined CCL and CSR model.

Or any other paid and incurred model that you deemappropriate.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 102: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

The Quest for a Minimum Variance Estimator

Ned Tyrrell pulled me into combined models to get moreaccurate, i.e. less variability in the, estimates of the lossreserve liability.Ned’s objective appears to have been met for CA, PA andOL.My suggestions for using combined models

1 Fit standalone CCL and CSR models.2 Compare αw parameters.3 If the above parameters are sufficiently close, fit a

combined CCL and CSR model.Or any other paid and incurred model that you deemappropriate.

Glenn Meyers Introduction to Bayesian MCMC Models

Page 103: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Concluding Remarks

The first part of the workshop was high-level description ofBayesian MCMC, emphasizing one way of “how to do it.”The second part of the workshop was more focused onwhat it can do, and passing over many of the fine pointsof how to do it.

A common theme to all the examples was fitting a lossdistribution with covariates.The predictive distribution is a mixture of fairly simpledistributions over a large sample from the posteriordistribution.Do not expect to master this technique quickly. It willtake a lot of work.

Done!

Glenn Meyers Introduction to Bayesian MCMC Models

Page 104: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Concluding Remarks

The first part of the workshop was high-level description ofBayesian MCMC, emphasizing one way of “how to do it.”The second part of the workshop was more focused onwhat it can do, and passing over many of the fine pointsof how to do it.A common theme to all the examples was fitting a lossdistribution with covariates.The predictive distribution is a mixture of fairly simpledistributions over a large sample from the posteriordistribution.

Do not expect to master this technique quickly. It willtake a lot of work.

Done!

Glenn Meyers Introduction to Bayesian MCMC Models

Page 105: Introduction to Bayesian MCMC Models - HOME (EN) · Introduction to Bayesian MCMC Models Glenn Meyers Introduction MCMC Theory MCMC History Introductory Example Using Stan Loss Reserve

Introductionto Bayesian

MCMCModels

Glenn Meyers

Introduction

MCMCTheory

MCMCHistory

IntroductoryExample

Using Stan

Loss ReserveModels

CCL Model

CSR Model

CCL ∪ CSR

Remarks

Concluding Remarks

The first part of the workshop was high-level description ofBayesian MCMC, emphasizing one way of “how to do it.”The second part of the workshop was more focused onwhat it can do, and passing over many of the fine pointsof how to do it.A common theme to all the examples was fitting a lossdistribution with covariates.The predictive distribution is a mixture of fairly simpledistributions over a large sample from the posteriordistribution.Do not expect to master this technique quickly. It willtake a lot of work.

Done!Glenn Meyers Introduction to Bayesian MCMC Models