Educerie

Educerie · AP · Statistics

AP Statistics 2.8

Introduction to Random Variables and Probability Distributions

How do we describe chance and variation, so that a claim about a population can be backed by numbers?

What you will learn

  • Understand a random variable as a number that depends on chance
  • Know that a discrete distribution lists every value with its probability and the probabilities sum to 1
  • Understand a cumulative distribution as P(X at most x)
  • Know that a distribution can come from the rules of probability or a simulation

You must be able to

  1. Define a random variable in words
  2. Find a missing probability from the sum to 1
  3. Calculate probabilities such as P(X at least 2) from a table
  4. Construct a distribution as a table, graph or function
  5. Construct and read a cumulative distribution
  6. Estimate a distribution from simulation results

In the exam. Section I multiple choice asks you to find a missing probability, read a probability from a table or histogram of a distribution, use a cumulative distribution, or say which variable is properly defined. The distribution is the starting point of the two-to-three-part sets on a shared stimulus in Unit 2, which go on to a mean and a binomial probability. In Section II, a clear definition of the variable and a correct table are the first marks of a probability question. Skill 3.A.

1Random variables

A random variable is a number that depends on chance. Not every random outcome is a random variable: the color of a car is an outcome, but it is not a number. "The number of red cars in a sample of 10" is a random variable.

Example: toss a coin 3 times. The outcome is a sequence of heads and tails. The random variable XX = "the number of heads in 3 tosses" has the possible values 0, 1, 2 and 3.

Define the variable in words. The exam gives marks for a clear definition, with the thing being counted and where it is counted. "XX is the number of heads in 3 tosses" is a definition. "XX is heads" is not, and "XX is the mean" does not say what is being measured.

A discrete random variable takes a countable set of values, often whole numbers, such as 0, 1, 2 and so on. This topic is about discrete ones. A continuous random variable can take any value in an interval, like a time or a mass, and Topic 2.11 deals with it.

2A probability distribution

The distribution of a discrete random variable has two rules.

  • Every probability is between 0 and 1.
  • The probabilities of all the possible values add to 1.

P(X=x1)+P(X=x2)+⋯+P(X=xk)=1 P(X = x_1) + P(X = x_2) + \cdots + P(X = x_k) = 1

The possible values are separate, non-overlapping outcomes, so their probabilities add. This is the same fact as "the sample space has probability 1" from 2.4.

Finding a missing probability. The number of items a customer returns, XX, has this distribution, with one value missing.

xx01234
P(X=x)P(X = x)0.300.350.200.10?

The probabilities add to 1, so P(X=4)=1−(0.30+0.35+0.20+0.10)=0.05P(X = 4) = 1 - (0.30 + 0.35 + 0.20 + 0.10) = 0.05.

Using the distribution. To find the probability of a set of values, add the probabilities of every value in the set.

P(X≥2)=P(X=2)+P(X=3)+P(X=4)=0.20+0.10+0.05=0.35add each value included in "at least 2"P(X \ge 2) = P(X = 2) + P(X = 3) + P(X = 4) = 0.20 + 0.10 + 0.05 = 0.35 \qquad \textcolor{#838c91}{\text{add each value included in "at least 2"}}
P(X<2)=P(X=0)+P(X=1)=0.65"less than 2" does not include 2P(X < 2) = P(X = 0) + P(X = 1) = 0.65 \qquad \textcolor{#838c91}{\text{"less than 2" does not include 2}}

These two answers are complements, and 0.35+0.65=10.35 + 0.65 = 1. Watch the inequality: "at least 2" includes 2, "more than 2" does not, "fewer than 2" does not, and "at most 2" does.

3Building a distribution from the rules of probability

Example: roll two fair dice, and let XX be the larger of the two numbers (the maximum). What is the distribution of XX?

The 36 ordered pairs of dice are equally likely (2.4). Count the pairs for each value of XX.

  • X=1X = 1 only for (1, 1): 1 pair.
  • X=2X = 2 for (1, 2), (2, 1), (2, 2): 3 pairs.
  • X=kX = k for the pairs with a kk and no larger number: 2k−12k - 1 pairs.
xx123456
P(X=x)P(X = x)1 ÷ 363 ÷ 365 ÷ 367 ÷ 369 ÷ 3611 ÷ 36

Check: 1+3+5+7+9+11=361 + 3 + 5 + 7 + 9 + 11 = 36, so the probabilities add to 1. This is a distribution, and the function that gives it is P(X=x)=(2x−1)/36P(X = x) = (2x - 1)/36 for x=1,2,…,6x = 1, 2, \dots, 6.

Figure 1 is the probability histogram of XX.

Figure 1. Probability histogram of X, the larger of two fair dice: the bar heights rise from 1/36 at X = 1 to 11/36 at X = 6, and the six bars add to 1 1 2 3 4 5 6 0.1 0.2 0.3 0 probability value of X 1/36 3/36 5/36 7/36 9/36 11/36
Figure 1 · Probability histogram of the larger of two fair dice, X

Each bar's height is the probability of that value of XX, and the six heights add to 1. The distribution is skewed left: the bars climb to the largest value and fall away to small values, so the single most likely value is 6. This is a graph of the distribution, a description of the whole variable. It is not a graph of data from one sample.

4The cumulative distribution

A cumulative distribution shows, for each value xx, the probability that XX is less than or equal to xx, written P(X≤x)P(X \le x). It is found by adding the probabilities up to xx.

xx123456
P(X≤x)P(X \le x)1 ÷ 364 ÷ 369 ÷ 3616 ÷ 3625 ÷ 3636 ÷ 36

Each entry is the one before it plus the new probability, for example 4/36+5/36=9/364/36 + 5/36 = 9/36. It always ends at 1.

Reading the table:

  • P(X≤4)=16/36P(X \le 4) = 16/36 is read straight from the table.
  • P(X≥5)P(X \ge 5) is the complement of P(X≤4)P(X \le 4): 1−16/36=20/36≈0.5561 - 16/36 = 20/36 \approx 0.556. Direct addition gives the same: 9/36+11/369/36 + 11/36.
  • P(X=4)P(X = 4) is the difference of neighboring entries: 16/36−9/36=7/3616/36 - 9/36 = 7/36.

For a discrete variable, "X≤4X \le 4" includes 4, so the cumulative value at 4 is not the same as P(X<4)P(X < 4), which is the entry for 3.

5Estimating a distribution by simulation

A distribution that is hard to work out can be estimated. Simulate the random process many times, record the value of XX each time, and use the relative frequencies as estimates of the probabilities, as in 2.3.

A simulation of 360 rolls of two dice recorded the larger number each time.

xx123456
Frequency1232528573106
Relative frequency0.0330.0890.1440.2360.2030.294
Exact probability0.0280.0830.1390.1940.2500.306

The frequencies add to 360. The simulated values follow the shape of the exact distribution, with the largest bar at 6, but they do not match exactly (here 4 beats 5, which the exact values do not). For instance, the simulation gives P(X≥5)P(X \ge 5) as (73+106)/360=0.497(73 + 106)/360 = 0.497, while the exact value is 0.556. More trials would bring the estimate closer.

Practice questions

30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.