10. Continuous Random Variables
Warning!
There be calculus within these pages. Yaarrrrghh!
Probability Density Function¶
Definition¶
If X is a continuous random variable, then X can assume any value within some interval (e.g. \((1,4)\), \((-\infty,\pi)\), etc) rather than a set of discrete values.
In this situation, \(P_X(z)=0\mid\forall z\in\R\), because an interval contains infinitely many points.
We can only speak of probabilities of X lying in some subinterval: \(P(a<X<b)\), \(P(X<b)\), \(P(X>a)\)
We use the probability density function of \(X\), denoted \(f_X\), to calculate the probabilities of \(X\) falling in any given interval.
How do we do this?
Example
Suppose \(X\in(1,6)\), and \(X\)’s probability density function looks like this.
For the sake of example, let’s say we are looking for \(P(3<X<4)\). This value can be found by calculating the area under the graph in that given interval.
Applying principles from calculus, we know that the area is equal to \(\int_3^4f_X(t)dt\)
Properties of Probability Density Functions¶
- \(f_X≥0\) always
- The total area under the graph of \(f_X\) is 1
- \(\int_{-\infty}^\infty f_X(t)dt=1\)
\(f_X\) has the property, for any \(a,b\in\R\):
Is \(f_X\) a density function?
\(f_X(x)=\begin{cases}\frac34(2x-x^2)&0<x<2\\0&otherwise\end{cases}\)
Is this a density function?
- \(f_x≥0\) always
- Yes
- \(\int_{-\infty}^\infty f_x(t)dt=1\)
- \(\int_{-\infty}^\infty f_x(t)dt=\int_{0}^2 \frac34(2x-x^2)dx=\frac34(x^2-\frac{x^3}3)\Bigr|_0^2=\frac34(4-\frac83)=1\)
- Yes
\(f_X\) is a density function.
Find \(P(1<X,\frac23)\)
Cumulative Distribution Function¶
Definition¶
The cumulative distribution function \(F_X\) (of a continuous random variable X) is defined as:
This is the area under the graph up to \(a\).
By no coincidence, this is also \(P(X<a)\)
This function is useful because \(P(a<X<b)=F_X(b)-F_X(a)\).
It saves us from having to repeatedly calculate integrals at every step, by doing it once at the beginning.
Continuing from previous example
\(f_X(x)=\begin{cases}\frac34(2x-x^2)&0<x<2\\0&otherwise\end{cases}\)
\(F_X(x)=\begin{cases}0&x<0\\\int_0^x\frac34(2t-t^2)dt&0<x<2\\1&x>2\end{cases}\)
That’s very nice and all, but we want to avoid repetitive integration, so we calculate it here:
Our final cumulative distribution function looks like this:
So if we want to find \(P(1<X<\frac23)\), all we need to do is \(F_X(\frac23)-F_X(1)\)
Properties of \(F_X(x)\)¶
- \(F\) is always increasing
- \(\lim_{x\to\infty}F(x)=1\)
- \(\lim_{x\to-\infty}F(x)=0\)
- \(F\) is always continuous, even if \(f\) isn’t!
Expected Value of Continuous Random Variables¶
Properties of Expected Values¶
All the properties carry over from the Expected Value of discrete random variables.
\(E\left[g(X)\right]=\int_{-\infty}^\infty g(x)\cdot f(x)dx\)
Variance of Continuous Random Variables¶
Variance is defined the same way as for discrete random variables:
As with discrete random variables,
All properties of \(V\) and \(\sigma\) carry also apply to continuous random variables.