Random Variables and PDFs
Pick one of the five flats at random. Its number of rooms is not fixed until you pick, but you can still say exactly how likely each value is. A number decided by chance is a random variable, and models describe their uncertainty with them all the time: "rent is probably around 20, give or take 4".
The rule
Discrete: probability sits on points. Continuous: probability is area under the density.
Discrete random variables take separate values you can list. Let be the rooms of a random flat from A to E. The rooms are 1, 2, 3, 2 and 2, so the probability mass function is:
| Rooms | 1 | 2 | 3 |
|---|---|---|---|
| Probability | 0.2 | 0.6 | 0.2 |
The probabilities sum to 1. The expected value is the probability-weighted average:
Continuous random variables can take any value in a range, like the exact rent of a flat in a new city. There are infinitely many possible values, so any single exact value has probability 0. Instead, a probability density function (PDF) is a curve, and the probability of landing in a range is the area under the curve over that range. The total area is 1.
Suppose rents in a new city are equally likely anywhere from 10 to 30 thousand. The density is flat, and to make the total area 1 over a width of 20, its height is . Then
A density is probability per unit, not a probability. So it can be bigger than 1: a density spread evenly from 0 to 0.5 must have height 2 to give area 1. The cumulative distribution function is the area to the left of , and it always climbs from 0 to 1.