\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
  \usepackage{amsmath,color,hyperref}
  \usepackage[round]{natbib}
  \usepackage[english]{babel}
  \usepackage[scaled=0.9]{helvet}
  \usepackage[sc]{mathpazo}
  \usepackage{paralist}
  \usepackage[noae]{Sweave}

  %\VignetteIndexEntry{Complete formulas used by coverage}
  %\VignettePackage{actuar}

  \title{Complete formulas used by \code{coverage}}
  \author{Vincent Goulet \\ École d'actuariat, Université Laval}
  \date{}

  %% Some new commands
  \newcommand{\proglang}[1]{\textsf{#1}}
  \newcommand{\pkg}[1]{\textbf{#1}}
  \newcommand{\code}[1]{\texttt{#1}}
  \newcommand{\D}{\displaystyle}

  \bibliographystyle{plainnat}

  \definecolor{Red}{rgb}{0.7,0,0}
  \definecolor{Blue}{rgb}{0,0,0.8}
  \hypersetup{%
    hyperindex = {true},
    colorlinks = {true},
    linktocpage = {true},
    plainpages = {false},
    linkcolor = {Blue},
    citecolor = {Blue},
    urlcolor = {Red},
    pdfstartview = {Fit},
    pdfpagemode = {UseOutlines},
    pdfview = {XYZ null null null}
  }

<<echo=FALSE>>=
library(actuar)
@

\begin{document}

\maketitle

Function \code{coverage} of \pkg{actuar} defines a new function to
compute the probability density function (pdf) of cumulative
distribution function (cdf) of any probability law under the following
insurance coverage modifications: ordinary or franchise deductible,
limit, coinsurance, inflation.

In addition, the function can return the distribution of either the
payment per loss or the payment per payment random variable. This
terminology refers to whether or not the insurer knows that a loss
occurred. For the exact definitions of the terms as used by
\code{coverage}, see Chapter~5 of \cite{LossModels2e}.

In the presence of a deductible, four random variables can be defined:
\begin{enumerate}
\item $Y^P$, the payment per payment with an ordinary deductible;
\item $Y^L$, the payment per loss with an ordinary deductible;
\item $\tilde{Y}^P$, the payment per payment with a franchise
  deductible;
\item $\tilde{Y}^L$, the payment per loss with a franchise deductible.
\end{enumerate}
The most common case in insurance applications is the distribution of
the amount paid per payment with an ordinary deductible, $Y^P$.
Hence, it is the default in \code{coverage}.

When there is no deductible, all four random variables are equivalent.

This document presents the definitions of the above four random
variables and their corresponding cdf and pdf for a deductible $d$, a
limit $u$, a coinsurance level $\alpha$ and an inflation rate $r$. An
illustrative plot of each cdf and pdf is also included. In these
plots, a dot indicates a probability mass at the given point.

In definitions below, $X$ is the nonnegative random variable of the
losses with cdf $F_X(\cdot)$ and pdf $f_X(\cdot)$.

\bibliography{actuar}


<<echo=FALSE>>=
deductible <- 5
limit <- 13
@

\section{Payment per payment, ordinary deductible}

<<echo=FALSE>>=
pgammaL <- coverage(cdf = pgamma, deductible = deductible, limit = limit,
                     per.loss = TRUE)
dgammaL <- coverage(dgamma, pgamma, deductible = deductible, limit = limit,
                     per.loss = TRUE)
pgammaP <- coverage(cdf = pgamma, deductible = deductible, limit = limit)
dgammaP <- coverage(dgamma, pgamma, deductible = deductible, limit = limit)

d <- deductible
u <- limit - d
e <- 0.001
ylim <- c(0, dgammaL(0, 5, 0.6))
@

\begin{align*}
  Y^P
  &=
  \begin{cases}
    \alpha ((1 + r) X - d),
      & \D\frac{d}{1 + r} \leq X < \frac{u}{1 + r} \\
    \alpha (u - d),
      & \D X \geq \frac{u}{1 + r}
  \end{cases} & \\
  F_{Y^P}(y)
  &=
  \begin{cases}
    0,
      & y = 0 \\
    \D\frac{F_X \left( \frac{y + \alpha d}{\alpha (1 + r)} \right) - F_X
      \left( \frac{d}{1 + r} \right)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & 0 < y < \alpha (u - d) \\
    1,
      & y \geq \alpha(u - d)
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(pgammaP(x, 5, 0.6), from = 0, to = u - e,
      xlim = c(0, limit), ylim = c(0, 1),
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(pgammaP(x, 5, 0.6), from = u, add = TRUE, lwd = 2)
axis(1, at = c(0, u), labels = c("0", "u - d"))
@
  \end{minipage} \\
  f_{Y^P}(y)
  &=
  \begin{cases}
    0,
      & y = 0 \\
    \left( \D\frac{1}{\alpha (1 + r)} \right)
    \D\frac{f_X \left( \frac{y + \alpha d}{\alpha(1 + r)} \right)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & 0 < y < \alpha (u - d) \\
    \D\frac{1 - F_X \Big( \frac{u}{1 + r} \Big)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & y = \alpha(u - d)
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(dgammaP(x, 5, 0.6), from = 0 + e, to = u - e,
      xlim = c(0, limit), ylim = ylim,
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
points(u, dgammaP(u, 5, 0.6), pch = 16)
axis(1, at = c(0, u), labels = c("0", "u - d"))
@
  \end{minipage}
\end{align*}


\section{Payment per loss, ordinary deductible}

\begin{align*}
  Y^L
  &=
  \begin{cases}
    0,
      & X < \D \frac{d}{1 + r} \\
    \alpha ((1 + r) X - d),
      & \D\frac{d}{1 + r} \leq X < \frac{u}{1 + r} \\
    \alpha (u - d),
      & \D X \geq \frac{u}{1 + r}
  \end{cases} & \\
  F_{Y^L}(y)
  &=
  \begin{cases}
    F_X \left( \D\frac{d}{1 + r} \right),
      & y = 0 \\
    F_X \left( \D\frac{y + \alpha d}{\alpha(1 + r)} \right),
      & 0 < y < \alpha (u - d) \\
    1,
      & y \geq \alpha(u - d)
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(pgammaL(x, 5, 0.6), from = 0, to = u - e,
      xlim = c(0, limit), ylim = c(0, 1),
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(pgammaL(x, 5, 0.6), from = u, add = TRUE, lwd = 2)
axis(1, at = c(0, u), labels = c("0", "u - d"))
@
  \end{minipage} \\
  f_{Y^L}(y)
  &=
  \begin{cases}
    F_X \left( \D\frac{d}{1 + r} \right),
      & y = 0 \\
    \D\frac{1}{\alpha (1 + r)} f_X \left( \D\frac{y + \alpha
        d}{\alpha(1 + r)} \right),
      & 0 < y < \alpha (u - d) \\
    1 - F_X \left( \D\frac{u}{1 + r} \right),
      & y = \alpha(u - d)
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(dgammaL(x, 5, 0.6), from = 0 + e, to = u - e,
      xlim = c(0, limit), ylim = ylim,
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
points(c(0, u), dgammaL(c(0, u), 5, 0.6), pch = 16)
axis(1, at = c(0, u), labels = c("0", "u - d"))
@
  \end{minipage}
\end{align*}


\section{Payment per payment, franchise deductible}

<<echo=FALSE>>=
pgammaL <- coverage(cdf = pgamma, deductible = deductible, limit = limit,
                     per.loss = TRUE, franchise = TRUE)
dgammaL <- coverage(dgamma, pgamma, deductible = deductible, limit = limit,
                     per.loss = TRUE, franchise = TRUE)
pgammaP <- coverage(cdf = pgamma, deductible = deductible, limit = limit,
                    franchise = TRUE)
dgammaP <- coverage(dgamma, pgamma, deductible = deductible, limit = limit,
                    franchise = TRUE)

d <- deductible
u <- limit
e <- 0.001
ylim <- c(0, dgammaL(0, 5, 0.6))
@

\begin{align*}
  \tilde{Y}^P
  &=
  \begin{cases}
    \alpha (1 + r) X,
      & \D\frac{d}{1 + r} \leq X < \frac{u}{1 + r} \\
    \alpha u,
      & \D X \geq \frac{u}{1 + r}
  \end{cases} & \\
  F_{\tilde{Y}^P}(y)
  &=
  \begin{cases}
    0,
      & 0 \leq y \leq \alpha d \\
    \D\frac{F_X \left( \frac{y}{\alpha (1 + r)} \right) - F_X
      \left( \frac{d}{1 + r} \right)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & \alpha d < y < \alpha u \\
    1,
      & y \geq \alpha u
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(pgammaP(x, 5, 0.6), from = 0, to = u - e,
      xlim = c(0, limit + d), ylim = c(0, 1),
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(pgammaP(x, 5, 0.6), from = u, add = TRUE, lwd = 2)
axis(1, at = c(0, d, u), labels = c("0", "d", "u"))
@
  \end{minipage} \\
  f_{\tilde{Y}^P}(y)
  &=
  \begin{cases}
    0,
      & 0 \leq y \leq \alpha d \\
    \left( \D\frac{1}{\alpha (1 + r)} \right)
    \D\frac{f_X \left( \frac{y}{\alpha(1 + r)} \right)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & \alpha d < y < \alpha u \\
    \D\frac{1 - F_X \Big( \frac{u}{1 + r} \Big)}{%
      1 - F_X \left( \frac{d}{1 + r} \right)},
      & y = \alpha u
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(dgammaP(x, 5, 0.6), from = d + e, to = u - e,
      xlim = c(0, limit + d), ylim = ylim,
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(dgammaL(x, 5, 0.6), from = 0 + e, to = d, add = TRUE, lwd = 2)
points(u, dgammaP(u, 5, 0.6), pch = 16)
axis(1, at = c(0, d, u), labels = c("0", "d", "u"))
@
  \end{minipage}
\end{align*}


\section{Payment per loss, franchise deductible}

\begin{align*}
  \tilde{Y}^L
  &=
  \begin{cases}
    0,
      & X < \D \frac{d}{1 + r} \\
    \alpha (1 + r) X,
      & \D\frac{d}{1 + r} \leq X < \frac{u}{1 + r} \\
    \alpha u,
      & \D X \geq \frac{u}{1 + r}
  \end{cases} & \\
  F_{\tilde{Y}^L}(y)
  &=
  \begin{cases}
    F_X \left( \D\frac{d}{1 + r} \right),
      & 0 \leq y \leq \alpha d \\
    F_X \left( \D\frac{y}{\alpha(1 + r)} \right),
      & \alpha d < y < \alpha u \\
    1,
      & y \geq \alpha u
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(pgammaL(x, 5, 0.6), from = 0, to = u - e,
      xlim = c(0, limit + d), ylim = c(0, 1),
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(pgammaL(x, 5, 0.6), from = u, add = TRUE, lwd = 2)
axis(1, at = c(0, d, u), labels = c("0", "d", "u"))
@
  \end{minipage} \\
  f_{\tilde{Y}^L}(y)
  &=
  \begin{cases}
    F_X \left( \D\frac{d}{1 + r} \right),
      & y = 0 \\
    \D\frac{1}{\alpha (1 + r)} f_X \left( \D\frac{y}{\alpha(1 + r)} \right),
      & \alpha d < y < \alpha u \\
    1 - F_X \left( \D\frac{u}{1 + r} \right),
      & y = \alpha u
  \end{cases} &
  \begin{minipage}{0.4\linewidth}
<<echo=FALSE, fig=TRUE, width=4, height=3>>=
par(mar = c(2, 3, 1, 1))
curve(dgammaL(x, 5, 0.6), from = d + e, to = u - e,
      xlim = c(0, limit + d), ylim = ylim,
      xlab = "", ylab = "", xaxt = "n", lwd = 2)
curve(dgammaL(x, 5, 0.6), from = 0 + e, to = d, add = TRUE, lwd = 2)
points(c(0, u), dgammaL(c(0, u), 5, 0.6), pch = 16)
axis(1, at = c(0, d, u), labels = c("0", "d", "u"))
@
  \end{minipage}
\end{align*}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% coding: utf-8
%%% End:
