<!--
.. title: Hassett, chapter 9: Applications for continuous random variables.
.. date: 2025-07-03 Thu 22:55
.. description: notes on Hassett and Stewart, chapter 9
.. type: text
.. has_math: true
-->

{{% hassett_navigation %}}

[TOC]

# 9.1 Expected value of a function of a random variable.

There's a special notation for the expected value of the amount paid
for an insurance loss with a deductible and for an insurance with a
cap.

With a loss random variable $X$ and deductible $x$, the expected value
of the payment is written as $E[(X-x)_+]$.

With loss random variable $X$ and cap $x$, the expected payment is
$E[(X\wedge x)]$.

If you have a utility function, you can find its expectation value.

# 9.2 (exclude) Moment-generating functions for continuous random variables

I'm happy to skip the moment generating functions.

# 9.3 (exclude) The distribution of $Y=g(X)$

Okay, fine.  The only surprise here is one of things where a
derivative shows up — which would probably not surprise me if I
remembered to write the probability density as a differential.

# 9.4 (exclude) Simulation of continuous distributions

This is basically from Numerical Recipes:  simulate a nonuniform
distribution by generating uniform random variables and seeing where
they fall on the cumulative distribution function.  The inverse of the
c.d.f. is helpful here.

# 9.5 Mixed distributions

Sometimes it's useful to mix discrete and continuous distributions.

* There's an appliance repair warranty.  Of the customers, 90% don't
  file any claim, while 10% file exactly one claim.  The claim amounts
  are uniformly distributed on $(\$0,\$1000]$.  This gives a
  cumulative probability distribution
  $$\begin{aligned}
  F(x) &= \begin{cases}
    0                 & x < 0  \\\\
    0.90              & x = 0  \\\\
    0.90 + 0.10 \frac{x}{1000} & 0 < x < 1000  \\\\
    1                 & x > 1000  \\\\
  \end{cases}
  \end{aligned}$$

Probability density function from $F(x) = \int_{-\infty}^x \mathrm dP$:

$$\begin{aligned}
\mathrm dP(x) &= \mathrm dx \times \begin{cases}
    0                 & x < 0  \\\\
    0.90 \delta(x)    & x = 0  \\\\
    0.10\frac{x}{1000} & 0 < x < 1000  \\\\
    0                 & x > 1000  \\\\
\end{cases}
\end{aligned}$$

However, Robert, people who aren't physicists are not going to use
Dirac's delta distribution.  The jargon in this community is that this
mixed distribution has a "point mass" at $x=0$, which you'd illustrate
with a big dot adjacent to the line curve.

![A plot of this mixed-density distribution.](assets/mixed-density-distribution.svg)

On the other hand, actually making this figure accentuates the
usefulness of the delta function.  Here I've had to fudge the vertical
scale or the horizontal scale or both in some ad-hoc fashion.  We have
to pretend that the area under the rectangular curve adds up to a
total probability of 0.1, so that the probability in the "point mass"
can stay 0.9.

To find expectation values, we kind of have to mix the discrete sum
with the continuous integral:

$$\begin{aligned}
E(X) &= \sum x \cdot p_\text{discrete}(x) + \int x \mathrm dP
\\\\ &= 0 \times 0.90 + \int_{0}^{1000} \frac{x\ \mathrm dx}{1000}
\times 0.10
\end{aligned}$$

> A new machine part is selected for installation and inspected.
> The probability that the part fails inspection and is not used is 0.01.
> If the part passes inspection and is used, its lifetime is
> exponential with mean 100.  Find the probability distribution of
> $T$, the lifetime of a randomly-selected part.

This should be something like

$$\begin{aligned}
\frac{\mathrm dP}{\mathrm dt} &=
    \left(0.01 \times 0\right)
    + \left(0.99 \times \frac{1}{100} e^{-t/100} \right)
\end{aligned}$$

The discrete distribution would have been easier, I think:

$$\begin{aligned}
F(t) &= \begin{cases}
    0                 & t < 0 \\\\
    0.01              & t = 0 \\\\
    0.99\times \left(1-e^{-t/100}\right) & 0 < t < \infty \\\\
\end{cases}
\end{aligned}$$

# 9.6 (exclude) Two useful identities

First useful identity:  the survival function can be found from the
hazard function:

$$\begin{aligned}
S(x) &= exp \left(
    -\int_0^x \lambda(u) \mathrm du
\right)
\end{aligned}$$

This works because

$$\begin{aligned}
\frac{\mathrm d}{\mathrm dx} S(x)
\\\\&= \frac{\mathrm d}{\mathrm dx} (1-F(x))
\\\\&= -f(x)
\end{aligned}$$

while

$$\begin{aligned}
\lambda(x)
    &= \frac{f(x)}{S(x)}
\\\\&= \frac{\mathrm d}{\mathrm dx} \ln S(x)
\end{aligned}$$

# Problems
