2.2 Discrete Probability Distributions ====================================== :bolditalic:`Key Terms` :bolditalic:`Discrete probability distribution(離散機率分配)` A description of the possible values of a discrete random variable and the probability assigned to each value. :bolditalic:`Probability mass function(機率質量函數)` A function that gives the probability of each possible value of a discrete random variable. :bolditalic:`PMF(機率質量函數)` Short form of probability mass function. :bolditalic:`Cumulative distribution function(累積分配函數)` A function that gives the probability accumulated up to and including a specified value. :bolditalic:`CDF(累積分配函數)` Short form of cumulative distribution function. :bolditalic:`Support(支撐集)` The set of values that a random variable can take with positive probability. 2.2.2 Learning Outcomes ----------------------- After completing this section, students should be able to: - construct a discrete probability distribution from a random experiment; - explain the meaning of :math:`p(x)=P(X=x)`; - identify the support of a discrete random variable; - check whether a PMF is valid; - interpret a probability histogram; - explain the meaning of :math:`F(x)=P(X\leq x)`; - construct a CDF from a PMF; - explain why a discrete CDF is a step function; - use a PMF or CDF to calculate simple probabilities. 2.2.3 One Example Throughout: Sum of Two Fair Dice --------------------------------------------------- Roll two fair six-sided dice. Let .. math:: X=\text{sum of the two dice}. There are .. math:: 6\times6=36 ordered outcomes, and all 36 are equally likely. The possible values of :math:`X` are .. math:: 2,3,4,5,6,7,8,9,10,11,12. Different ordered outcomes can produce the same value of :math:`X`. For example, .. math:: X=4 can occur through .. math:: (1,3),\ (2,2),\ (3,1). The 36 equally likely outcomes and their corresponding sums are shown below. Cells with the same number produce the same value of :math:`X`. .. image:: ../_static/figures/random_variables/figure_2_2_1_two_dice_sum_outcomes.png :width: 58% :align: center :alt: Six by six grid of two-dice outcomes, with each cell labeled by the sum of the two dice. The number of outcomes producing each sum is .. list-table:: :header-rows: 1 :widths: 20 25 27 28 * - :math:`x` - Number of outcomes - :math:`p(x)=P(X=x)` - :math:`F(x)=P(X\leq x)` * - 2 - 1 - :math:`1/36` - :math:`1/36` * - 3 - 2 - :math:`2/36` - :math:`3/36` * - 4 - 3 - :math:`3/36` - :math:`6/36` * - 5 - 4 - :math:`4/36` - :math:`10/36` * - 6 - 5 - :math:`5/36` - :math:`15/36` * - 7 - 6 - :math:`6/36` - :math:`21/36` * - 8 - 5 - :math:`5/36` - :math:`26/36` * - 9 - 4 - :math:`4/36` - :math:`30/36` * - 10 - 3 - :math:`3/36` - :math:`33/36` * - 11 - 2 - :math:`2/36` - :math:`35/36` * - 12 - 1 - :math:`1/36` - :math:`36/36=1` This single table contains both the **PMF** and the **CDF**. The difference is how the probability is interpreted. 2.2.4 Probability Mass Function ------------------------------- The **probability mass function**, or PMF, gives the probability at one specific value. .. note:: **Probability Mass Function** .. math:: p(x)=P(X=x). For the two-dice example, .. math:: p(7)=P(X=7)=\frac{6}{36}=\frac16. The value 7 has the largest probability because six ordered outcomes produce that sum. The PMF is shown graphically below. .. image:: ../_static/figures/random_variables/figure_2_2_2_two_dice_sum_pmf.png :width: 64% :align: center :alt: Probability mass function for the sum of two fair dice. The graph emphasizes two properties of a discrete probability distribution: - probability is attached to separate possible values of :math:`X`; - the possible values do not need to be equally likely. For example, .. math:: P(X=2)=\frac{1}{36}, \qquad P(X=7)=\frac{6}{36}. Although both 2 and 7 are possible values, they have different probabilities. 2.2.5 Conditions for a Valid PMF -------------------------------- A PMF must satisfy two conditions. First, .. math:: p(x)\geq0 for every possible value :math:`x`. Second, .. math:: \sum_x p(x)=1. For the two-dice example, .. math:: \frac{1+2+3+4+5+6+5+4+3+2+1}{36} = \frac{36}{36} = 1. Therefore, the PMF is valid. 2.2.6 Cumulative Distribution Function -------------------------------------- The PMF gives probability **at** one value. The **cumulative distribution function**, or CDF, gives probability **up to and including** a value. .. note:: **Cumulative Distribution Function** .. math:: F(x)=P(X\leq x). For a discrete random variable, the CDF is obtained by adding PMF probabilities from the smallest possible value up to :math:`x`. For example, .. math:: F(4) = P(X\leq4) = \frac{1+2+3}{36} = \frac{6}{36} = \frac16. Similarly, .. math:: F(7) = P(X\leq7) = \frac{1+2+3+4+5+6}{36} = \frac{21}{36} = \frac{7}{12}. The CDF therefore accumulates probability as :math:`x` moves from left to right. 2.2.7 Why a Discrete CDF Is a Step Function ------------------------------------------- The CDF is defined for **every real value** of :math:`x`, not only for values in the support of :math:`X`. For example, the sum of two dice cannot be 6.5. Therefore, .. math:: F(6.5)=P(X\leq6.5)=P(X\leq6)=F(6). No new probability is added between 6 and 7. The CDF remains constant until the next possible value is reached. .. image:: ../_static/figures/random_variables/figure_2_2_3_two_dice_sum_cdf.png :width: 68% :align: center :alt: Step-shaped cumulative distribution function for the sum of two fair dice. Thus, a discrete CDF is a **step function**. At each possible value, the size of the jump equals the PMF probability at that value. For example, the jump at :math:`x=7` is .. math:: p(7)=\frac{6}{36}. This gives the direct connection .. math:: \text{PMF value} \quad\longleftrightarrow\quad \text{CDF jump size}. 2.2.8 Finding Probabilities from the PMF ---------------------------------------- For probabilities involving several possible values, add the corresponding PMF values. For example, .. math:: P(5`, or intervals. For example, .. math:: P(X>8) = 1-F(8) = 1-\frac{26}{36} = \frac{10}{36} = \frac{5}{18}. 2.2.10 Recovering the PMF from the CDF -------------------------------------- For an integer-valued discrete random variable, the probability at a value is the increase in the CDF at that value. For the two-dice example, .. math:: p(7) = F(7)-F(6) = \frac{21}{36}-\frac{15}{36} = \frac{6}{36}. Thus, the PMF and CDF contain the same probability information but organize it differently. 2.2.11 PMF Versus CDF --------------------- The two functions answer different questions. .. list-table:: :header-rows: 1 :widths: 28 36 36 * - Function - Meaning - Example * - PMF :math:`p(x)` - Probability **at** one value - :math:`p(7)=P(X=7)` * - CDF :math:`F(x)` - Probability **up to and including** a value - :math:`F(7)=P(X\leq7)` The PMF appears as separate probability masses or bars. The discrete CDF appears as a nondecreasing step function. 2.2.12 A Simple Method ---------------------- For a discrete probability distribution: 1. Define the random variable :math:`X`. 2. List its possible values. 3. Determine which sample points produce each value. 4. Add their probabilities to obtain :math:`p(x)`. 5. Check that :math:`p(x)\geq0` and :math:`\sum_x p(x)=1`. 6. Accumulate the PMF from left to right to obtain :math:`F(x)`. 7. Use the PMF or CDF according to the probability being requested. 2.2.13 Common Mistakes ---------------------- Do not confuse the value :math:`X=7` with the probability :math:`P(X=7)`. Do not assume that all possible values are equally likely. Do not confuse .. math:: p(x)=P(X=x) with .. math:: F(x)=P(X\leq x). The PMF gives probability at one value; the CDF gives accumulated probability. Remember that the CDF is defined for all real values of :math:`x`, even between possible values of the discrete random variable. 2.2.14 Summary -------------- A discrete probability distribution assigns probabilities to the possible values of a discrete random variable. The PMF is .. math:: p(x)=P(X=x), with .. math:: p(x)\geq0 \qquad\text{and}\qquad \sum_x p(x)=1. The CDF is .. math:: F(x)=P(X\leq x). For a discrete random variable, the CDF is obtained by accumulating PMF probabilities and therefore appears as a step function. The size of each CDF jump equals the corresponding PMF probability. .. 2.2.15 Short Review Questions .. ----------------------------- .. 1. If :math:`X` is the sum of two fair dice, what is the support of :math:`X`? .. 2. Find :math:`P(X=7)`. .. 3. Find :math:`F(7)`. .. 4. Why is the CDF constant between 6 and 7? .. 5. Use the CDF to find :math:`P(5