# HIDDEN
import warnings
warnings.filterwarnings('ignore')
from datascience import *
from prob140 import *
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
%matplotlib inline
import math
from scipy import stats
import warnings
warnings.filterwarnings("ignore")
A random variable T has the exponential distribution with parameter λ if the density of T is given by
fT(t)=λe−λt,t≥0
The graph below shows the density fT for λ=5.
# NO CODE
lam = 5
t = np.arange(0, 1, 0.01)
y = stats.expon.pdf(t, scale=1/5)
plt.plot(t, y, color='darkblue', lw=2)
plt.xlabel('$t$')
plt.ylabel('$f_T(t)$', rotation=False)
plt.title('Density of $T$');
from IPython.display import YouTubeVideo
YouTubeVideo('D8DAKgt-NUk')
The exponential distribution is often used as a model for random lifetimes, in settings that we will study in greater detail below. For now, just think of T as the lifetime of an object like a lightbulb, and note that the cdf at time t can be thought of as the chance that the object dies before time t:
P(T≤t)=FT(t)=1−e−λt
The complementary event is that the object survives past time t, and therefore its probability defines the survival functionST:
ST(t)=P(T>t)=1−FT(t)=e−λt
Answer
e−1
Answer
Density at t is λe−λt, survival function at t is e−λt
either by integration by parts or by recognizing the indefinite integral of λte−λt . Since T is a non-negative variable, an easier way is to use the tail integral, analogous to the tail sum formula for the expectation of a non-negative integer valued random variable.
E(T)=∫0∞S(t)dt=∫0∞e−λtdt=λ1
To find E(T2), you can use integration by parts, or you can accept for now that E(T2)=2/λ2 and therefore
Var(T)=λ21and SD(T)=λ1
Later in the course we will see how to find E(T2) without integration.
The graph below shows the density fT with the labeled points on the horizontal axis corresponding to standard units of -1, 0, 1, 2, and 3. The random variable T can’t be negative, and the density doesn’t go further than 1 SD below the mean. The spread comes from the long right hand tail.
# NO CODE
lam = 5
sd = 1/lam
t = np.arange(0, 4.6*sd, 0.01)
y = stats.expon.pdf(t, scale=sd)
plt.plot(t, y, color='darkblue', lw=2)
plt.xticks(np.arange(0, 4*sd+0.1, sd),
['0', '$1/\lambda$', '$2/\lambda$', '$3/\lambda$', '$4/\lambda$'])
plt.yticks([0, lam/4, lam/2, 3*lam/4, lam],
['0','','','', '$\lambda$'])
plt.xlim(-0.01, 4.6*sd)
plt.ylim(-0.05, lam)
plt.xlabel('$t$')
plt.ylabel('$f_T(t)$', rotation=0)
plt.title('Exponential $(\lambda)$ Density of $T$');
Because log(2)<1, the median lifetime t0.5 is less than the mean lifetime E(T)=1/λ as you can see on the graph. This is consistent with an observation you made in Data 8: if a distribution has a right hand tail, the median is less than the mean.
The exponential distribution is often used to model lifetimes of objects like radioactive atoms that undergo exponential decay. The half life of a radioactive isotope is defined as the time by which half of the atoms of the isotope will have decayed. That is, the half life is the median of the exponential lifetime of the atom. The parameter λ is called the decay rate of the atom. By the property of the median t0.5 derived above, the relation between λ and the half life is
Let s and t be positive, and let’s find the conditional probability that the object survives a further s units of time given that it has already survived t.
Notice that t does not appear in the answer. So for example the chance that the object survives an additional year given that it has been alive for 50 years is the same as the chance that is survives a year when it starts out brand new. It forgets that it has already lived 50 years.
This is called the memoryless property of the exponential distribution. It can be shown that the exponential and the geometric are the only two distributions that have the memoryless property. As you can see, the graph of the exponential density resembles the geometric probability histogram. It can be thought of as a continuous limit of the geometric, as we will see later.
The memoryless property is an excellent reason not to use the exponential distribution to model the lifetimes of people or of anything that ages. For lifetimes of things like lightbulbs or radioactive atoms, the exponential distribution often does fine.
If λ is large, then E(T)=1/λ is small. If you think of T as a lifetime then large λ implies that an early death is expected. To formalize the notion of λ as a rate, let Δt be a tiny increment of time and use the memoryless property:
P(T≤t+Δt∣T>t)=1−e−λΔt=λΔt+2!λ2Δt2+⋯∼λΔtbecause Δt is small
The left hand side is the chance that the object dies immediately after time t, given that it was still alive at time t. We say that λ is the instantaneous death rate, because