text
stringlengths 235
3.08k
|
---|
: In this table, median household income (in $1000s) from a random sample of 100 counties that had population gains are shown on the left. Median incomes from a random sample of 50 counties that had no population gain are shown on the right. Population: Gain Population: No Gain | 2 |12 | 2 |79 4| 3 |1234 99999987555| 3 |5555799 444433322111000| 4 |00111223333 999998887666666665555| 4 |55666666789 444333222221111110000| 5 |1112222 887776666555| 5 |6677 33333222100| 6 |01 9| 6 | 42| 7 | 85| 7 | 21| 8 | Legend: 2 |1 = 21,000 median income Figure 2.20: Back-to-back stem-and-leaf plot for median income, split by whether the count had a population gain or no gain. 2.2. NUMERICAL SUMMARIES AND BOX PLOTS 91 Figure 2.21: Side-by-side box plot (left panel) and hollow histograms (right panel) for med hh income, where the counties are split by whether or not there was a population gain from 2010 to 2017. Explore this data set on Tableau Public. The side-by-side box plot is a traditional tool for comparing across groups. An example is shown in the left panel of Figure 2.21, where there are two box plots, one for each group, placed into one plotting window and drawn on the same scale. Another useful plotting method uses hollow histograms to compare numerical data across groups. These are just the outlines of histograms of each group put on the same plot, as shown in the right panel of Figure 2.21. GUIDED PRACTICE 2.53 Use the plots in Figure 2.21 to compare the incomes for counties across the two groups. What do you notice about the approximate center of each group? What do you notice about the variability between groups? Is the shape relatively consistent between groups? How many prominent modes are there for each group?36 COMPARING DISTRIBUTIONS When comparing distributions, compare them with respect to center, spread, and shape as well as any unusual observations. Such descriptions should be in context. GUIDED PRACTICE 2.54 What components of each plot in Figure 2.21 do you find most useful?37 36Answers
|
may vary a little. The counties with population gains tend to have higher income (median of about $45,000) versus counties without a gain (median of about $40,000). The variability is also slightly larger for the population gain group. This is evident in the IQR, which is about 50% bigger in the gain group. Both distributions show slight to moderate right skew and are unimodal. The box plots indicate there are many observations far above the median in each group, though we should anticipate that many observations will fall beyond the whiskers when examining any data set that contain more than a couple hundred data points. 37Answers will vary. The parallel box plots are especially useful for comparing centers and spreads, while the hollow histograms are more useful for seeing distribution shape, skew, and groups of anomalies. Change in PopulationGainNo Gain$20k$40k$60k$80k$100k$120kMedian Household IncomeMedian Household Income$20k$40k$60k$80k$100kGainNo Gain 92 CHAPTER 2. SUMMARIZING DATA GUIDED PRACTICE 2.55 Do these graphs tell us about any association between income for the two groups?38 Looking at an association is different than comparing distributions. When comparing distributions, we are interested in questions such as, “Which distribution has a greater average?” and “How do the shapes of the distribution differ?” The number of elements in each data set need not be the same (e.g. height of women and height of men). When we look at association, we are interested in whether there is a positive, negative, or no association between the variables. This requires two data sets of equal length that are essentially paired (e.g. height and weight of individuals). COMPARING DISTRIBUTIONS VERSUS LOOKING AT ASSOCIATION We compare two distributions with respect to center, spread, and shape. To compare the distributions visually, we use 2 single-variable graphs, such as two histograms, two dot plots, parallel box plots, or a back-to-back stem-and-leaf. When looking at association, we look for a positive, negative, or no relationship between the variables. To see association visually, we require a scatterplot. 2.2.9 Mapping data (special topic) The county data set offers many numerical variables
|
that we could plot using dot plots, scatterplots, or box plots, but these miss the true nature of the data. Rather, when we encounter geographic data, we should create an intensity map, where colors are used to show higher and lower values of a variable. Figures 2.22 and 2.23 shows intensity maps for poverty rate in percent (poverty), unemployment rate (unemployment rate), homeownership rate in percent (homeownership), and median household income (median hh income). The color key indicates which colors correspond to which values. The intensity maps are not generally very helpful for getting precise values in any given county, but they are very helpful for seeing geographic trends and generating interesting research questions or hypotheses. EXAMPLE 2.56 What interesting features are evident in the poverty and unemployment rate intensity maps? Poverty rates are evidently higher in a few locations. Notably, the deep south shows higher poverty rates, as does much of Arizona and New Mexico. High poverty rates are evident in the Mississippi flood plains a little north of New Orleans and also in a large section of Kentucky. The unemployment rate follows similar trends, and we can see correspondence between the two variables. In fact, it makes sense for higher rates of unemployment to be closely related to poverty rates. One observation that stand out when comparing the two maps: the poverty rate is much higher than the unemployment rate, meaning while many people may be working, they are not making enough to break out of poverty. GUIDED PRACTICE 2.57 What interesting features are evident in the median hh income intensity map in Figure 2.23(b)?39 38No, to see association we require a scatterplot. Moreover, these data are not paired, so the discussion of association does not make sense here. 39Note: answers will vary. There is some correspondence between high earning and metropolitan areas, where we can see darker spots (higher median household income), though there are several exceptions. You might look for large cities you are familiar with and try to spot them on the map as dark spots. 2.2. NUMERICAL SUMMARIES AND BOX PLOTS 93 (a) (b) Figure 2.22: (a) Intensity map of poverty rate (percent). (b) Intensity map of the unemployment rate (percent). Explore dozens of intensity maps using American Community Survey data on Tableau Public. 2%14%>25%Poverty2%4%>7%Unemployment Rate 94 CHAPTER 2
|
. SUMMARIZING DATA (a) (b) Figure 2.23: (a) Intensity map of homeownership rate (percent). (b) Intensity map of median household income ($1000s). Explore dozens of intensity maps using American Community Survey data on Tableau Public. <55%73%91%Homeownership Rate$19$47>$75Median Household Income 2.2. NUMERICAL SUMMARIES AND BOX PLOTS 95 Section summary • In this section we looked at univariate summaries, including two measures of center and three mea- sures of spread. • When summarizing or comparing distributions, always comment on center, spread, and shape. Also, mention outliers or gaps if applicable. Put descriptions in context, that is, identify the variable(s) being summarized by name and include relevant units. Remember: Center, Spread, and Shape! In context! • Mean and median are measures of center. (A common mistake is to report mode as a measure of center. However, a mode can appear anywhere in a distribution.) – The mean is the sum of all the observations divided by the number of observations, n. ¯x = 1 n xi = xi n = x1+x2+...+xn n – In an ordered data set, the median is the middle number when n is odd. When n is even, the median is the average of the two middle numbers. • Because large values exert more “pull” on the mean, large values on the high end tend to increase the mean more than they increase the median. In a right skewed distribution, therefore, the mean is greater than the median. Analogously, in a left skewed distribution, the mean is less than the median. Remember: The mean follows the tail! The skew is the tail! • Standard deviation (SD) and Interquartile range (IQR) are measures of spread. SD measures the typical spread from the mean, whereas IQR measures the spread of the middle 50% of the data. – To calculate the standard deviation, subtract the average from each value, square all those differences, add them up, divide by n − 1, then take the square root. Note: The standard deviation is the square root of the variance. sX = 1 n−1 (xi − ¯x)2 – The IQR is the difference between the third quartile Q3 and the fi
|
rst quartile Q1. IQR = Q3 − Q1 • Range is also sometimes used as a measure of spread. The range of a data set is defined as the difference between the maximum value and the minimum value, i.e. max − min. • Outliers are observations that are extreme relative to the rest of the data. Two rules of thumb for identifying observations as outliers are: – more than 2 standard deviations above or below the mean – more than 1.5 × IQR below Q1 or above Q3 • Mean and SD are sensitive to outliers. Median and IQR are more robust and less sensitive to outliers. • A Z-score represents the number of standard deviations a value in a data set is above or below the mean. To calculate a Z-score use: Z = x−mean SD. • Z-scores do not depend on units. When looking at distributions with different units or different standard deviations, Z-scores are useful for comparing how far values are away from the mean (relative to the distribution of the data). • Linear transformations of data. Adding a constant to every value in a data set shifts the mean but does not affect the standard deviation. Multiplying the values in a data set by a constant will multiply the mean and the standard deviation by that constant, except that the standard deviation must always remain positive. • Box plots do not show the distribution of a data set in the way that histograms do. Rather, they provide a visual depiction of the 5-number summary, which consists of: min, Q1, Q2, Q3, max. While a box plot does not indicate modes, it can show skew and outliers. 96 CHAPTER 2. SUMMARIZING DATA Exercises 2.7 Smoking habits of UK residents, Part I. A survey was conducted to study the smoking habits of UK residents. The histograms below display the distributions of the number of cigarettes smoked on weekdays and weekends, and they exclude data from people who identified themselves as non-smokers. Describe the two distributions and compare them.40 2.8 Stats scores, Part I. Below are the final exam scores of twenty introductory statistics students. 79, 83, 57, 82, 94, 83, 72, 74, 73, 71, 66, 89, 78, 81,
|
78, 81, 88, 69, 77, 79 Draw a histogram of these data and describe the distribution. 2.9 Smoking habits of UK residents, Part II. A random sample of 5 smokers from the data set discussed in Exercise 2.7 is provided below. gender Female Male Female Female Female age maritalStatus 51 24 33 17 76 Married Single Married Single Widowed grossIncome £2,600 to £5,200 £10,400 to £15,600 £10,400 to £15,600 £5,200 to £10,400 £5,200 to £10,400 smoke Yes Yes Yes Yes Yes amtWeekends 20 cig/day 20 cig/day 20 cig/day 20 cig/day 20 cig/day amtWeekdays 20 cig/day 15 cig/day 10 cig/day 15 cig/day 20 cig/day (a) Find the mean amount of cigarettes smoked on weekdays and weekends by these 5 respondents. (b) Find the standard deviation of the amount of cigarettes smoked on weekdays and on weekends by these 5 respondents. Is the variability higher on weekends or on weekdays? 2.10 Factory defective rate. A factory quality control manager decides to investigate the percentage of defective items produced each day. Within a given work week (Monday through Friday) the percentage of defective items produced was 2%, 1.4%, 4%, 3%, 2.2%. (a) Calculate the mean for these data. (b) Calculate the standard deviation for these data, showing each step in detail. 40National STEM Centre, Large Datasets from stats4schools. Amount Weekends0102030405060050100Amount Weekdays0102030405060050 2.2. NUMERICAL SUMMARIES AND BOX PLOTS 97 2.11 Days off at a mining plant. Workers at a particular mining site receive an average of 35 days paid vacation, which is lower than the national average. The manager of this plant is under pressure from a local union to increase the amount of paid time off. However, he does not want to give more days off to the workers because that would be costly. Instead he decides he should fire 10 employees in such a way as to raise the average number of days off that are reported by his employees. In order to achieve this goal, should he fire employees who have the most number of days off, least number of days
|
off, or those who have about the average number of days off? 2.12 Medians and IQRs. For each part, compare distributions (1) and (2) based on their medians and IQRs. You do not need to calculate these statistics; simply state how the medians and IQRs compare. Make sure to explain your reasoning. (a) (1) 3, 5, 6, 7, 9 (2) 3, 5, 6, 7, 20 (b) (1) 3, 5, 6, 7, 9 (2) 3, 5, 7, 8, 9 (c) (1) 1, 2, 3, 4, 5 (2) 6, 7, 8, 9, 10 (d) (1) 0, 10, 50, 60, 100 (2) 0, 100, 500, 600, 1000 2.13 Means and SDs. For each part, compare distributions (1) and (2) based on their means and standard deviations. You do not need to calculate these statistics; simply state how the means and the standard deviations compare. Make sure to explain your reasoning. Hint: It may be useful to sketch dot plots of the distributions. (a) (1) 3, 5, 5, 5, 8, 11, 11, 11, 13 (2) 3, 5, 5, 5, 8, 11, 11, 11, 20 (c) (1) 0, 2, 4, 6, 8, 10 (2) 20, 22, 24, 26, 28, 30 (b) (1) -20, 0, 0, 0, 15, 25, 30, 30 (2) -40, 0, 0, 0, 15, 25, 30, 30 (d) (1) 100, 200, 300, 400, 500 (2) 0, 50, 300, 550, 600 2.14 Mix-and-match. Describe the distribution in the histograms below and match them to the box plots. (a)506070(b)050100(c)0246(1)0246(2)55606570(3)020406080100 98 CHAPTER 2. SUMMARIZING DATA 2.15 Air quality. Daily air quality is measured by the air quality index (AQI) reported by the Environmental Protection Agency. This index reports the pollution level and what associated health e�
|
��ects might be a concern. The index is calculated for five major air pollutants regulated by the Clean Air Act and takes values from 0 to 300, where a higher value indicates lower air quality. AQI was reported for a sample of 91 days in 2011 in Durham, NC. The relative frequency histogram below shows the distribution of the AQI values on these days.41 (a) Estimate the median AQI value of this sample. (b) Would you expect the mean AQI value of this sample to be higher or lower than the median? Explain your reasoning. (c) Estimate Q1, Q3, and IQR for the distribution. (d) Would any of the days in this sample be considered to have an unusually low or high AQI? Explain your reasoning. 2.16 Median vs. mean. Estimate the median for the 400 observations shown in the histogram, and note whether you expect the mean to be higher or lower than the median. 2.17 Histograms vs. box plots. Compare the two plots below. What characteristics of the distribution are apparent in the histogram and not in the box plot? What characteristics are apparent in the box plot but not in the histogram? 2.18 Facebook friends. Facebook data indicate that 50% of Facebook users have 100 or more friends, and that the average friend count of users is 190. What do these findings suggest about the shape of the distribution of number of friends of Facebook users?42 41US Environmental Protection Agency, AirData, 2011. 42Lars Backstrom. “Anatomy of Facebook”. In: Facebook Data Team’s Notes (2011). Daily AQI10203040506000.050.10.150.2405060708090100020406080510152025050100150200510152025 2.2. NUMERICAL SUMMARIES AND BOX PLOTS 99 2.19 Distributions and appropriate statistics, Part I. For each of the following, state whether you expect the distribution to be symmetric, right skewed, or left skewed. Also specify whether the mean or median would best represent a typical observation in the data, and whether the variability of observations would be best represented using the standard deviation or IQR. Explain your reasoning. (a) Number of pets per household. (b) Distance to work, i.e. number of miles between work and home. (c) Heights of adult
|
males. 2.20 Distributions and appropriate statistics, Part II. For each of the following, state whether you expect the distribution to be symmetric, right skewed, or left skewed. Also specify whether the mean or median would best represent a typical observation in the data, and whether the variability of observations would be best represented using the standard deviation or IQR. Explain your reasoning. (a) Housing prices in a country where 25% of the houses cost below $350,000, 50% of the houses cost below $450,000, 75% of the houses cost below $1,000,000 and there are a meaningful number of houses that cost more than $6,000,000. (b) Housing prices in a country where 25% of the houses cost below $300,000, 50% of the houses cost below $600,000, 75% of the houses cost below $900,000 and very few houses that cost more than $1,200,000. (c) Number of alcoholic drinks consumed by college students in a given week. Assume that most of these students don’t drink since they are under 21 years old, and only a few drink excessively. (d) Annual salaries of the employees at a Fortune 500 company where only a few high level executives earn much higher salaries than all the other employees. 2.21 Income at the coffee shop. The first histogram below shows the distribution of the yearly incomes of 40 patrons at a college coffee shop. Suppose two new people walk into the coffee shop: one making $225,000 and the other $250,000. The second histogram shows the new income distribution. Summary statistics are also provided. n Min. 1st Qu. Median Mean 3rd Qu. Max. SD (1) 40 60,680 63,620 65,240 65,090 66,160 69,890 2,122 (2) 42 60,680 63,710 65,350 73,300 66,540 250,000 37,321 (a) Would the mean or the median best represent what we might think of as a typical income for the 42 patrons at this coffee shop? What does this say about the robustness of the two measures? (b) Would the standard deviation or the IQR best represent the amount of variability in the incomes of the 42 patrons at this coffee shop? What does this say about the robustness of
|
the two measures? 2.22 Midrange. The midrange of a distribution is defined as the average of the maximum and the minimum of that distribution. Is this statistic robust to outliers and extreme skew? Explain your reasoning (1)$60k$62.5k$65k$67.5k$70k04812(2)$60k$110k$160k$210k$260k04812 100 CHAPTER 2. SUMMARIZING DATA 2.23 Commute times. The US census collects data on time it takes Americans to commute to work, among many other variables. The histogram below shows the distribution of average commute times in 3,142 US counties in 2010. Also shown below is a spatial intensity map of the same data. (a) Describe the numerical distribution for commute times. (b) Describe the spatial distribution of commuting times using the map provided. 2.24 Hispanic/Latine population. The US census collects data on race and ethnicity of Americans, among many other variables. The histogram below shows the distribution of the percentage of the population that is Hispanic/Latine in 3,142 counties in the US in 2017. (a) Describe the distribution of percent of population that is Hispanic/Latine for counties in the US. (b) What features of the distribution of the Hispanic/Latine population in US counties are apparent in the map but not in the histogram? What features are apparent in the histogram but not the map? Mean work travel (in min)102030400100200419>33Hispanic/Latinx %0204060801000500100015002000020>40 2.3. NORMAL DISTRIBUTION 101 2.3 Normal distribution What proportion of adults have systolic blood pressure above 140? What is the probability of getting more than 250 heads in 400 tosses of a fair coin? If the average weight of a piece of carry-on luggage is 11 pounds, what is the probability that 200 random carry on pieces will weigh more than 2500 pounds? If 55% of a population supports a certain candidate, what is the probability that she will have less than 50% support in a random sample of size 200? There is one distribution that can help us answer all of these questions. Can you guess what it is? That’s right – it’s the normal distribution. Learning objectives 1. Use Z-scores and the standard normal model to approximate a
|
distribution where appropriate. 2. Find probabilities and percentiles using the normal approximation. 3. Find the value that corresponds to a given percentile when the distribution is approximately normal. 2.3.1 Normal distribution model Among all the distributions we see in practice, one is overwhelmingly the most common. The symmetric, unimodal, bell curve is ubiquitous throughout statistics. Indeed it is so common, that people often know it as the normal curve or normal distribution.43 A normal curve is shown in Figure 2.24. Figure 2.24: A normal curve. The normal distribution always describes a symmetric, unimodal, bell-shaped curve. However, these curves can look different depending on the details of the model. Specifically, the normal distribution model can be adjusted using two parameters: mean and standard deviation. As you can probably guess, changing the mean shifts the bell curve to the left or right, while changing the standard deviation stretches or constricts the curve. 43It is also introduced as the Gaussian distribution after Frederic Gauss, the first person to formalize its mathe- matical expression. 102 CHAPTER 2. SUMMARIZING DATA Figure 2.25 shows the normal distribution with mean 0 and standard deviation 1 in the left panel and the normal distributions with mean 19 and standard deviation 4 in the right panel. Figure 2.26 shows these distributions on the same axis. Figure 2.25: Both curves represent the normal distribution. However, they differ in their center and spread. Figure 2.26: The normal distributions shown in Figure 2.25 but plotted together and on the same scale. Because the mean and standard deviation describe a normal distribution exactly, they are called the distribution’s parameters. The normal distribution with mean µ = 0 and standard deviation σ = 1 is called the standard normal distribution.. NORMAL DISTRIBUTION FACTS Many variables are nearly normal, but none are exactly normal. The normal distribution, while never perfect, provides very close approximations for a variety of scenarios. We will use it to model data as well as probability distributions. −3−2−10123Y71115192327310102030 2.3. NORMAL DISTRIBUTION 103 2.3.2 Using the normal distribution to approximate empirical distributions We often want to put data onto a standardized scale, which can make comparisons more reasonable. EXAMPLE 2.58 Figure 2.27
|
shows the mean and standard deviation for total scores on the SAT and ACT. The distribution of SAT and ACT scores are both nearly normal. Suppose Ann scored 1300 on her SAT and Tom scored 24 on his ACT. Who performed better? As we saw in section 2.2.3, we can use Z-scores to compare observations from different distributions. Using Ann’s SAT score, 1300, along with the SAT mean and SD, we can find Ann’s Z-score. ZAnn = xAnn − µSAT σSAT = 1300 − 1100 200 = 1 Similarly, using Tom’s ACT score, 24, along with the ACT mean and SD we can find his Z-score. ZT om = xTom − µACT σACT = 24 − 21 6 = 0.5 Because Ann’s score was 1 standard deviation above the mean, while Tom’s score was 0.5 standard deviations above the mean, we can say that Ann did better than Tom. Mean SD SAT ACT 21 1100 6 200 Figure 2.27: Mean and standard deviation for the SAT and ACT. Assuming that both the SAT and ACT distributions are nearly normally distributed, what percent of test takers scored lower than Ann? What percent scored lower than Tom? To answer these question exactly, we would need all of the data. However, if we use the information that SAT and ACT distributions are nearly normal, we can estimate these percents. Figure 2.28 shows these distributions modeled with a normal curve. If we can find the percent of the normal curve that is to the left of Ann’s score, we could use that percent as our estimate of the percent of the data points that are smaller than Ann’s score. We call this process normal approximation. The steps are: 1. First verify that the distribution can be reasonably modeled with a normal distribution. 2. Convert value or values of interest to Z-scores. 3. Find the relevant area/percent under the standard normal curve. We use the area/percent that we find from the normal curve as our estimate of the desired percent. Figure 2.28: Ann’s and Tom’s scores shown with the distributions of SAT and ACT scores. X700900110013001500Ann915212733Tom 104 CHAPTER 2. SUMMARIZING DATA 2.3.3 Finding areas under the normal
|
curve It’s very useful in statistics to be able to identify areas of distributions, especially tail areas. For instance, what percent of people have an SAT score below Ann’s score of 1300? This is the same as Ann’s percentile. We previously determined that a score of 1300 corresponds to a Z-score of 1 and that SAT scores are approximately normally distributed. We can visualize such a tail area by sketching a normal curve and shading everything below Z = 1 as shown in Figure 2.29. Figure 2.29: The area to the left of the Z-score represents the percentile of the observation. There are many techniques for finding this area, and we’ll discuss three of the options. 1. The most common approach in practice is to use statistical software. For example, in the program R, we could find the area shown in Figure 2.29 using the following command, which takes in the Z-score of 1 and returns the lower tail area:.....> pnorm(1).....[1] 0.8413447 Using the online Desmos calculator, we could do: normaldist( ), check the “Find Cumulative Probability (CDF)” box and set Max to 1. According to these calculation, the area shaded that is below Z = 1 is 0.841, so we estimate that 84.1% of SAT test takers score below 1300 and that Ann is at the 84th percentile. There are many other software options, such as Python or SAS; even spreadsheet programs such as Excel and Google Sheets support these calculations. 2. A common strategy in classrooms is to use a graphing calculator, such as a TI or Casio calculaInstructions for finding areas of a normal distribution using these calculators are provided in tor. Section 2.3.7. 3. The last option for finding tail areas is to use what’s called a probability table; these are occasionally used in classrooms but rarely in practice. Appendix C.2 contains such a table and a guide for how to use it. We will solve normal distribution problems in this section by always first finding the Z-score. The reason is that we will encounter close parallels called test statistics beginning in Chapter 5; these are, in many instances, an equivalent of a Z-score. Readers may find it helpful
|
to familiarize themselves with one of the options above before continuing on to the applications that follow. −3−2−10123 2.3. NORMAL DISTRIBUTION 105 2.3.4 Normal probability examples Combined SAT scores are approximated well by a normal model with mean 1100 and standard deviation 200. EXAMPLE 2.59 What is the probability that a randomly selected SAT taker scores at least 1190 on the SAT? The probability that a randomly selected SAT taker scores at least 1190 on the SAT is equivalent to the proportion of all SAT takers that score at least 1190 on the SAT. First, always draw and label a picture of the normal distribution. (Drawings need not be exact to be useful.) We are interested in the probability that a randomly selected score will be above 1190, so we shade this upper tail: The picture shows the mean and the values at 2 standard deviations above and below the mean. The simplest way to find the shaded area under the curve makes use of the Z-score of the cutoff value. With µ = 1100, σ = 200, and the cutoff value x = 1190, the Z-score is computed as Z = x − µ σ = 1190 − 1100 200 = 90 200 = 0.45 Next, we want to find the area under the normal curve to right of Z = 0.45. Using technology, we find P (Z > 0.45) = 0.3264. The probability that a randomly selected score is at least 1190 on the SAT is 0.3264. ALWAYS DRAW A PICTURE FIRST, AND FIND THE Z-SCORE SECOND For any normal probability situation, always always always draw and label the normal curve and shade the area of interest first. The picture will provide an estimate of the probability. After drawing a figure to represent the situation, identify the Z-score for the observation of interest. GUIDED PRACTICE 2.60 If the probability that a randomly selected score is at least 1190 is 0.3264, what is the probability that the score is less than 1190? Draw the normal curve representing this exercise, shading the lower region instead of the upper one.44 44We found the probability in Example 2.59: 0.6736. A picture for this exercise is represented by the shaded area below “
|
0.6736” in Example 2.59. 70011001500 106 CHAPTER 2. SUMMARIZING DATA EXAMPLE 2.61 Edward earned a 1030 on his SAT. What is his percentile? First, a picture is needed. Edward’s percentile is the proportion of people who do not get as high as a 1030. These are the scores to the left of 1030. Identifying the mean µ = 1100, the standard deviation σ = 200, and the cutoff for the tail area x = 1030 makes it easy to compute the Z-score: Z = x − µ σ = 1030 − 1100 200 = −0.35 Using technology we find that P (Z < −0.35) = 0.3632. Edward is at the 36th percentile. GUIDED PRACTICE 2.62 Use the results of Example 2.61 to compute the proportion of SAT takers who did better than Edward. Also draw a new picture.45 The last several problems have focused on finding the probability or percentile for a particular obser- vation. It is also possible to identify the value corresponding to a particular percentile. 45If Edward did better than 36% of SAT takers, then about 64% must have done better than him. 7001100150070011001500 2.3. NORMAL DISTRIBUTION 107 EXAMPLE 2.63 Carlos believes he can get into his preferred college if he scores at least in the 80th percentile on the SAT. What score should he aim for? Here, we are given a percentile rather than a Z-score, so we work backwards. As always, first draw the picture. We want to find the observation that corresponds to the 80th percentile. First, we find the Z-score associated with the 80th percentile. Using technology, we find that P (Z < 0.84) = 0.80. In any normal distribution, a value with a Z-score of 0.84 will be at the 80th percentile. Once we have the Z-score, we work backwards to find x. Z = x − µ σ 0.84 = x − 1100 200 0.84 × 200 + 1100 = x x = 1268 The 80th percentile on the SAT corresponds to a score of 1268. GUIDED PRACTICE 2.64 Imani
|
scored at the 72nd percentile on the SAT. What was her SAT score?46 IF THE DATA ARE NOT NEARLY NORMAL, DON’T USE THE NORMAL APPROXIMATION Before using the normal approximation method, verify that the data or distribution is approximately normal. If it is not, the normal approximation will give incorrect results. Also remember that all answers based on normal approximations are in fact approximations and are not exact. Finally, we should observe that it is possible for a normal random variable to fall 4, 5, or even more standard deviations from the mean. The probability of being further than 4 standard deviations from the mean is about 1-in-15,000. For 5 and 6 standard deviations, it is about 1-in-2 million and 1-in-500 million, respectively. However, while the tails of the normal distribution extend infinitely in either direction, our data sets are finite and normal approximation in the extreme tails is unlikely to be very accurate, even for bell-shaped data sets. 46First, draw a picture! The closest percentile in the table to 0.72 is 0.7190, which corresponds to Z = 0.58. Next, set up the Z-score formula and solve for x: 0.58 = x−1100 200 → x = 1216. Imani scored 1216. 5007009001100130015001700 108 CHAPTER 2. SUMMARIZING DATA 2.3.5 68-95-99.7 rule Here, we present a useful rule of thumb for the probability of falling within 1, 2, and 3 standard deviations of the mean in the normal distribution. The 68-95-99.7 rule, also known as the empirical rule, will be useful in a wide range of practical settings, especially when trying to make a quick estimate without a calculator or Z-table. Figure 2.30: Probabilities for falling within 1, 2, and 3 standard deviations of the mean in a normal distribution. GUIDED PRACTICE 2.65 Use the Z-table to confirm that about 68%, 95%, and 99.7% of observations fall within 1, 2, and 3, standard deviations of the mean in the normal distribution, respectively. For instance, first find the area that falls between Z = −1 and Z = 1, which should have an area of about 0.68
|
. Similarly there should be an area of about 0.95 between Z = −2 and Z = 2.47 It is possible for a normal random variable to fall 4, 5, or even more standard deviations from the mean. However, these occurrences are very rare if the data are nearly normal. The probability of being further than 4 standard deviations from the mean is about 1-in-15,000. For 5 and 6 standard deviations, it is about 1-in-2 million and 1-in-500 million, respectively. GUIDED PRACTICE 2.66 SAT scores closely follow the normal model with mean µ = 1100 and standard deviation σ = 200. (a) About what percent of test takers score 700 to 1500? (b) What percent score between 1100 and 1500?48 47First draw the pictures. To find the area between Z = −1 and Z = 1, use the normal probability table to determine the areas below Z = −1 and above Z = 1. Next verify the area between Z = −1 and Z = 1 is about 0.68. Repeat this for Z = −2 to Z = 2 and also for Z = −3 to Z = 3. 48(a) 700 and 1500 represent two standard deviations above and below the mean, which means about 95% of test takers will score between 700 and 1500. (b) Since the normal model is symmetric, then half of the test takers from part (a) ( 95% 2 = 47.5% of all test takers) will score 700 to 1500 while 47.5% score between 1100 and 1500. m-3sm-2sm-smm+sm+2sm+3s99.7%95%68% 2.3. NORMAL DISTRIBUTION 109 2.3.6 Evaluating the normal approximation (special topic) It is important to remember normality is always an approximation. Testing the appropriateness of the normal assumption is a key step in many data analyses. The distribution of heights of US males is well approximated by the normal model. We are interested in proceeding under the assumption that the data are normally distributed, but first we must check to see if this is reasonable. There are two visual methods for checking the assumption of normality that can be implemented and interpreted quickly. The first is a simple histogram with the best fitting normal curve overlaid on the plot
|
, as shown in the left panel of Figure 2.31. The sample mean ¯x and standard deviation s are used as the parameters of the best fitting normal curve. The closer this curve fits the histogram, the more reasonable the normal model assumption. Another more common method is examining a normal probability plot,49 shown in the right panel of Figure 2.31. The closer the points are to a perfect straight line, the more confident we can be that the data follow the normal model. Figure 2.31: A sample of 100 male heights. The observations are rounded to the nearest whole inch, explaining why the points appear to jump in increments in the normal probability plot. EXAMPLE 2.67 Consider all NBA players from the 2018-2019 season presented in Figure 2.32. Based on the graphs, are NBA player heights normally distributed? We first create a histogram and normal probability plot of the NBA player heights. The histogram in the left panel is slightly left skewed, which contrasts with the symmetric normal distribution. The points in the normal probability plot do not appear to closely follow a straight line but show what appears to be a “wave”. NBA player heights do not appear to come from a normal distribution. GUIDED PRACTICE 2.68 Figure 2.33 shows normal probability plots for two distributions that are skewed. One distribution is skewed to the low end (left skewed) and the other to the high end (right skewed). Which is which?50 49Also commonly called a quantile-quantile plot. 50Examine where the points fall along the vertical axis. In the first plot, most points are near the low end with fewer observations scattered along the high end; this describes a distribution that is right skewed. The second plot shows the opposite features, and this distribution is left skewed. Male Heights (inches)6065707580llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllTheoretical QuantilesMale Heights (inches)−2−1012657075 110 CHAPTER 2. SUMMARIZING DATA Figure 2.32: Histogram and normal probability plot for the NBA heights from the 2018-2019 season. Figure 2.33: Normal probability plots for Guided
|
Practice 2.68. 2.3.7 Technology: finding normal probabilities Get started quickly with a Desmos Normal Calculator that we’ve put together (visit openintro.org/ahss/desmos). Height (inches)70758085llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllTheoretical Quantilesobserved−3−2−1012370758085lllllllllllllllllllllllllObservedTheoretical quantiles−2−1012012llllllllllllllllllllllllllllllllllllllllllllllllllObservedTheoretical quantiles−2−101251015 2.3. NORMAL DISTRIBUTION 111 TI-84: FINDING AREA UNDER THE NORMAL CURVE Use 2ND VARS, normalcdf to find an area/proportion/probability between two Z-scores or to the left or right of a Z-score. 1. Choose 2ND VARS (i.e. DISTR). 2. Choose 2:normalcdf. 3. Enter the lower (left) Z-score and the upper (right) Z-score. • If finding just a lower tail area,
|
set lower to -5. • If finding just an upper tail area, set upper to 5. 4. Leave µ as 0 and σ as 1. 5. Down arrow, choose Paste, and hit ENTER. TI-83: Do steps 1-2, then enter the lower bound and upper bound separated by a comma, e.g. normalcdf(2, 5), and hit ENTER. CASIO FX-9750GII: FINDING AREA UNDER THE NORMAL CURVE 1. Navigate to STAT (MENU, then hit 2). 2. Select DIST (F5), then NORM (F1), and then Ncd (F2). 3. If needed, set Data to Variable (Var option, which is F2). 4. Enter the Lower Z-score and the Upper Z-score. Set σ to 1 and µ to 0. • If finding just a lower tail area, set Lower to -5. • For an upper tail area, set Upper to 5. 5. Hit EXE, which will return the area probability (p) along with the Z-scores for the lower and upper bounds. GUIDED PRACTICE 2.69 Use a calculator or software to confirm that about 68%, 95%, and 99.7% of observations fall within 1, 2, and 3, standard deviations of the mean in the normal distribution, respectively.51 GUIDED PRACTICE 2.70 Find the area under the normal curve between -1.5 and 1.5. 52 EXAMPLE 2.71 Use a calculator to determine what percentile corresponds to a Z-score of 1.5 for a normal distribution.53 To find an area under the normal curve using a calculator, first identify a lower bound and an upper bound. We want all of the area to the left of 1.5, so the lower bound should be -∞. However, the area under the curve is negligible when Z is smaller than -5, so we will use -5 as the lower bound. Using a lower bound of -5 and an upper bound of 1.5, we get P (Z < 1.5) = 0.933. 51To find the area between Z = −1 and Z = 1, let lower bound be -1 and upper bound be 1. We find that P (−
|
1 < Z < 1) = 0.6827. Similarly, P (−2 < Z < 2) = 0.9545 and P (−3 < Z < 3) = 0.9973. 52Lower bound is -1.5 and upper bound is 1.5. The area under the normal curve between -1.5 and 1.5 = P (−1.5 < Z < 1.5) = 0.866. Note that is not simply the average of 0.6827 and 0.9545, as the normal curve is not a rectangle. 53normalcdf gives the result without drawing the graph. To draw the graph, do 2nd VARS, DRAW, 1:ShadeNorm. However, beware of errors caused by other plots that might interfere with this plot. −3−2−10123 112 CHAPTER 2. SUMMARIZING DATA GUIDED PRACTICE 2.72 Find the area under the normal curve to right of Z = 2. 54 TI-84: FIND A Z-SCORE THAT CORRESPONDS TO A PERCENTILE Use 2ND VARS, invNorm to find the Z-score that corresponds to a given percentile. 1. Choose 2ND VARS (i.e. DISTR). 2. Choose 3:invNorm. 3. Let Area be the percentile as a decimal (the area to the left of desired Z-score). 4. Leave µ as 0 and σ as 1. 5. Down arrow, choose Paste, and hit ENTER. TI-83: Do steps 1-2, then enter the percentile as a decimal, e.g. invNorm(.40), then hit ENTER. CASIO FX-9750GII: FIND A Z-SCORE THAT CORRESPONDS TO A PERCENTILE 1. Navigate to STAT (MENU, then hit 2). 2. Select DIST (F5), then NORM (F1), and then InvN (F3). 3. If needed, set Data to Variable (Var option, which is F2). 4. Decide which tail area to use (Tail), the tail area (Area), and then enter the σ and µ values. 5. Hit EXE. EXAMPLE 2.73 Use a calculator to find the Z-score that corresponds to the 40th percentile. Letting area be 0.40, a calculator gives -0.
|
253. This means that Z = −0.253 corresponds to the 40th percentile, that is, P (Z < −0.253) = 0.40. GUIDED PRACTICE 2.74 Find the Z-score such that 20 percent of the area is to the right of that Z-score.55 54Now we want to shade to the right. Therefore our lower bound will be 2 and the upper bound will be +5 (or a number bigger than 5) to get P (Z > 2) = 0.023. 55If 20% of the area is the right, then 80% of the area is to the left. Letting area be 0.80, we get Z = 0.841. 2.3. NORMAL DISTRIBUTION 113 Section summary • A Z-score represents the number of standard deviations a value in a data set is above or below the mean. To calculate a Z-score use: Z = x−mean SD. • The normal distribution is the most commonly used distribution in Statistics. Many distribution are approximately normal, but none are exactly normal. • The empirical rule (68-95-99.7 Rule) comes from the normal distribution. The closer a distribution is to normal, the better this rule will hold. • It is often useful to use the standard normal distribution, which has mean 0 and SD 1, to approximate a discrete histogram. There are two common types of normal approximation problems, and for each a key step is to find a Z-score. A: Find the percent or probability of a value greater/less than a given x-value. 1. Verify that the distribution of interest is approximately normal. 2. Calculate the Z-score. Use the provided population mean and SD to standardize the given x-value. 3. Use a calculator function (e.g. normcdf on a TI) or other technology to find the area under the normal curve to the right/left of this Z-score; this is the estimate for the percent/probability. B: Find the x-value that corresponds to a given percentile. 1. Verify that the distribution of interest is approximately normal. 2. Find the Z-score that corresponds to the given percentile (using, for example, invNorm on a TI). 3. Use the Z-score along with the given mean and SD to solve for the x -value. 114 CHAPTER 2. SUMMARIZING
|
DATA Exercises 2.25 Area under the curve, Part I. What percent of a standard normal distribution N (µ = 0, σ = 1) is found in each region? Be sure to draw a graph. (a) Z < −1.35 (b) Z > 1.48 (c) −0.4 < Z < 1.5 (d) |Z| > 2 2.26 Area under the curve, Part II. What percent of a standard normal distribution N (µ = 0, σ = 1) is found in each region? Be sure to draw a graph. (a) Z > −1.13 (b) Z < 0.18 (c) Z > 8 (d) |Z| < 0.5 2.27 GRE scores, Part I. Sophia who took the Graduate Record Examination (GRE) scored 160 on the Verbal Reasoning section and 157 on the Quantitative Reasoning section. The mean score for Verbal Reasoning section for all test takers was 151 with a standard deviation of 7, and the mean score for the Quantitative Reasoning was 153 with a standard deviation of 7.67. Suppose that both distributions are nearly normal. (a) What is Sophia’s Z-score on the Verbal Reasoning section? On the Quantitative Reasoning section? Draw a standard normal distribution curve and mark these two Z-scores. (b) What do these Z-scores tell you? (c) Relative to others, which section did she do better on? (d) Find her percentile scores for the two exams. (e) What percent of the test takers did better than her on the Verbal Reasoning section? On the Quantitative Reasoning section? (f) Explain why simply comparing raw scores from the two sections could lead to an incorrect conclusion as to which section a student did better on. (g) If the distributions of the scores on these exams are not nearly normal, would your answers to parts (b) - (e) change? Explain your reasoning. 2.28 Triathlon times, Part I. In triathlons, it is common for racers to be placed into age and gender groups. Friends Leo and Mary both completed the Hermosa Beach Triathlon, where Leo competed in the Men, Ages 30 - 34 group while Mary competed in the Women, Ages 25 - 29 group. Leo completed the race in 1:22:28 (4948 seconds
|
), while Mary completed the race in 1:31:53 (5513 seconds). Obviously Leo finished faster, but they are curious about how they did within their respective groups. Can you help them? Here is some information on the performance of their groups: • The finishing times of the Men, Ages 30 - 34 group has a mean of 4313 seconds with a standard deviation of 583 seconds. • The finishing times of the Women, Ages 25 - 29 group has a mean of 5261 seconds with a standard deviation of 807 seconds. • The distributions of finishing times for both groups are approximately Normal. Remember: a better performance corresponds to a faster finish. (a) What are the Z-scores for Leo’s and Mary’s finishing times? What do these Z-scores tell you? (b) Did Leo or Mary rank better in their respective groups? Explain your reasoning. (c) What percent of the triathletes did Leo finish faster than in his group? (d) What percent of the triathletes did Mary finish faster than in her group? (e) If the distributions of finishing times are not nearly normal, would your answers to parts (a) - (d) change? Explain your reasoning. 2.29 GRE scores, Part II. In Exercise 2.27 we saw two distributions for GRE scores: N (µ = 151, σ = 7) for the verbal part of the exam and N (µ = 153, σ = 7.67) for the quantitative part. Use this information to compute each of the following: (a) The score of a student who scored in the 80th percentile on the Quantitative Reasoning section. (b) The score of a student who scored worse than 70% of the test takers in the Verbal Reasoning section. 2.3. NORMAL DISTRIBUTION 115 2.30 Triathlon times, Part II. In Exercise 2.28 we saw two distributions for triathlon times: N (µ = 4313, σ = 583) for Men, Ages 30 - 34 and N (µ = 5261, σ = 807) for the Women, Ages 25 - 29 group. Times are listed in seconds. Use this information to compute each of the following: (a) The
|
cutoff time for the fastest 5% of athletes in the men’s group, i.e. those who took the shortest 5% of time to finish. (b) The cutoff time for the slowest 10% of athletes in the women’s group. 2.31 LA weather, Part I. deviation of 5◦F. Suppose that the temperatures in June closely follow a normal distribution. (a) What is the probability of observing an 83◦F temperature or higher in LA during a randomly chosen The average daily high temperature in June in LA is 77◦F with a standard day in June? (b) How cool are the coldest 10% of the days (days with lowest high temperature) during June in LA? 2.32 CAPM. The Capital Asset Pricing Model (CAPM) is a financial model that assumes returns on a portfolio are normally distributed. Suppose a portfolio has an average annual return of 14.7% (i.e. an average gain of 14.7%) with a standard deviation of 33%. A return of 0% means the value of the portfolio doesn’t change, a negative return means that the portfolio loses money, and a positive return means that the portfolio gains money. (a) What percent of years does this portfolio lose money, i.e. have a return less than 0%? (b) What is the cutoff for the highest 15% of annual returns with this portfolio? 2.33 LA weather, Part II. Exercise 2.31 states that average daily high temperature in June in LA is 77◦F with a standard deviation of 5◦F, and it can be assumed that they to follow a normal distribution. We use the following equation to convert ◦F (Fahrenheit) to ◦C (Celsius): C = (F − 32) × 5 9. (a) What is the probability of observing a 28◦C (which roughly corresponds to 83◦F) temperature or higher in June in LA? Calculate using the ◦C model from part (a). (b) Did you get the same answer or different answers in part (b) of this question and part (a) of Exercise 2.31? Are you surprised? Explain. (c) Estimate the IQR of the temperatures (in ◦C) in June in LA. 2
|
.34 Find the SD. Cholesterol levels for women aged 20 to 34 follow an approximately normal distribution with mean 185 milligrams per deciliter (mg/dl). Women with cholesterol levels above 220 mg/dl are considered to have high cholesterol and about 18.5% of women fall into this category. What is the standard deviation of the distribution of cholesterol levels for women aged 20 to 34? 2.35 Scores on stats final, Part I. Below are final exam scores of 20 Introductory Statistics students. 1 57, 2 66, 3 69, 4 71, 5 72, 6 73, 7 74, 8 77, 9 78, 10 78, 11 79, 12 79, 13 81, 14 81, 15 82, 16 83, 17 83, 18 88, 19 89, 20 94 The mean score is 77.7 points. with a standard deviation of 8.44 points. Use this information to determine if the scores approximately follow the 68-95-99.7% Rule. 2.36 Heights of female college students, Part I. Below are heights of 25 female college students. 1 54, 2 55, 3 56, 4 56, 5 57, 6 58, 7 58, 8 59, 9 60, 10 60, 11 60, 12 61, 13 61, 14 62, 15 62, 16 63, 17 63, 18 63, 19 64, 20 65, 21 65, 22 67, 23 67, 24 69, 25 73 The mean height is 61.52 inches with a standard deviation of 4.58 inches. Use this information to determine if the heights approximately follow the 68-95-99.7% Rule. 116 CHAPTER 2. SUMMARIZING DATA 2.4 Considering categorical data How do we visualize and summarize categorical data? In this section, we will introduce tables and other basic tools for categorical data that are used throughout this book and will answer the following questions: • Based on the loan50 data, is there an assocation between the categorical variables of homeownership and application type (individual, joint)? • Using the email50 data, does email type provide any useful value in classifying email as spam or not spam? Learning objectives 1. Use a one-way table and a bar chart to summarize a categorical variable. Use counts (frequency) or proportions (relative frequency). 2. Compare distributions of a categorical variable using a two-way table and a side-by-side bar chart,
|
segmented bar chart, or mosaic plot. 3. Calculate marginal and joint frequencies for two-way tables. 2.4.1 Contingency tables and bar charts Figure 2.34 summarizes two variables: app type and homeownership. A table that summarizes data for two categorical variables in this way is called a contingency table. Each value in the table represents the number of times a particular combination of variable outcomes occurred. For example, the value 3496 corresponds to the number of loans in the data set where the borrower rents their home and the application type was by an individual. Row and column totals are also included. The row totals provide the total counts across each row (e.g. 3496 + 3839 + 1170 = 8505), and column totals are total counts down each column. We can also create a table that shows only the overall percentages or proportions for each combination of categories, or we can create a table for a single variable, such as the one shown in Figure 2.35 for the homeownership variable. app type individual joint Total homeownership rent mortgage 3496 362 3858 3839 950 4789 own 1170 183 1353 Total 8505 1495 10000 Figure 2.34: A contingency table for app type and homeownership. homeownership Count 3858 rent 4789 mortgage 1353 own 10000 Total Figure 2.35: A table summarizing the frequencies of each value for the homeownership variable. A bar chart (also called bar plot or bar graph) is a common way to display a single categorical variable. The left panel of Figure 2.36 shows a bar chart for the homeownership variable. In the right panel, the counts are converted into proportions, showing the proportion of observations that are in each level (e.g. 3858/10000 = 0.3858 for rent). 2.4. CONSIDERING CATEGORICAL DATA 117 Figure 2.36: Two bar charts of number. The left panel shows the counts, and the right panel shows the proportions in each group. 2.4.2 Row and column proportions Sometimes it is useful to understand the fractional breakdown of one variable in another, and we can modify our contingency table to provide such a view. Figure 2.37 shows the row proportions for Figure 2.34, which are computed as the counts divided by their row totals. The value 3496 at the intersection of individual and rent is replaced by 3496/8505 = 0.411, i.e. 3496 divided
|
by its row total, 8505. So what does 0.411 represent? It corresponds to the proportion of individual applicants who rent. individual joint Total rent mortgage 0.451 0.635 0.479 0.411 0.242 0.386 own Total 1.000 1.000 1.000 0.138 0.122 0.135 Figure 2.37: A contingency table with row proportions for the app type and homeownership variables. The row total is off by 0.001 for the joint row due to a rounding error. A contingency table of the column proportions is computed in a similar way, where each column proportion is computed as the count divided by the corresponding column total. Figure 2.38 shows such a table, and here the value 0.906 indicates that 90.6% of renters applied as individuals for the loan. This rate is higher compared to loans from people with mortgages (80.2%) or who own their home (85.1%). Because these rates vary between the three levels of homeownership (rent, mortgage, own), this provides evidence that the app type and homeownership variables are associated. individual joint Total rent mortgage 0.802 0.198 1.000 0.906 0.094 1.000 own Total 0.851 0.150 1.000 0.865 0.135 1.000 Figure 2.38: A contingency table with column proportions for the app type and homeownership variables. The total for the last column is off by 0.001 due to a rounding error. We could also have checked for an association between app type and homeownership in Figure 2.37 using row proportions. When comparing these row proportions, we would look down columns to see if the fraction of loans where the borrower rents, has a mortgage, or owns varied across the individual to joint application types. rentmortgageownFrequency01000200030004000Homeownershiprentmortgageown0.00.10.20.30.4ProportionHomeownership 118 CHAPTER 2. SUMMARIZING DATA GUIDED PRACTICE 2.75 (a) What does 0.451 represent in Figure 2.37? (b) What does 0.802 represent in Figure 2.38?56 GUIDED PRACTICE 2.76 (a) What does 0.122 at the intersection of joint and own represent in Figure 2.37? (b) What does 0.135 represent in the Figure 2.38
|
?57 EXAMPLE 2.77 Data scientists use statistics to filter spam from incoming email messages. By noting specific characteristics of an email, a data scientist may be able to classify some emails as spam or not spam with high accuracy. One such characteristic is whether the email contains no numbers, small numbers, or big numbers. Another characteristic is the email format, which indicates whether or not an email has any HTML content, such as bolded text. We’ll focus on email format and spam status using the email data set, and these variables are summarized in a contingency table in Figure 2.39. Which would be more helpful to someone hoping to classify email as spam or regular email for this table: row or column proportions? A data scientist would be interested in how the proportion of spam changes within each email format. This corresponds to column proportions: the proportion of spam in plain text emails and the proportion of spam in HTML emails. If we generate the column proportions, we can see that a higher fraction of plain text emails are spam (209/1195 = 17.5%) than compared to HTML emails (158/2726 = 5.8%). This information on its own is insufficient to classify an email as spam or not spam, as over 80% of plain text emails are not spam. Yet, when we carefully combine this information with many other characteristics, we stand a reasonable chance of being able to classify some emails as spam or not spam with confidence. text HTML Total 367 158 209 spam 3554 2568 not spam 986 3921 2726 1195 Total Figure 2.39: A contingency table for spam and format. Example 2.77 points out that row and column proportions are not equivalent. Before settling on one form for a table, it is important to consider each to ensure that the most useful table is constructed. However, sometimes it simply isn’t clear which, if either, is more useful. EXAMPLE 2.78 Look back to Tables 2.37 and 2.38. Are there any obvious scenarios where one might be more useful than the other? None that we thought were obvious! What is distinct about app type and homeownership vs the email example is that these two variables don’t have a clear explanatory-response variable relationship that we might hypothesize (see Section 1.3.3 for these terms). Usually it is most useful to “condition” on the explanatory variable.
|
For instance, in the email example, the email format was seen as a possible explanatory variable of whether the message was spam, so we would find it more interesting to compute the relative frequencies (proportions) for each email format. 56(a) 0.451 represents the proportion of individual applicants who have a mortgage. (b) 0.802 represents the fraction of applicants with mortgages who applied as individuals. 57(a) 0.122 represents the fraction of joint borrowers who own their home. (b) 0.135 represents the home-owning borrowers who had a joint application for the loan. 2.4. CONSIDERING CATEGORICAL DATA 119 2.4.3 Using a bar chart with two variables Contingency tables using row or column proportions are especially useful for examining how two categorical variables are related. Segmented bar charts provide a way to visualize the information in these tables. A segmented bar chart, or stacked bar chart, is a graphical display of contingency table information. For example, a segmented bar chart representing Figure 2.38 is shown in Figure 2.40(a), where we have first created a bar chart using the homeownership variable and then divided each group by the levels of app type. One related visualization to the segmented bar chart is the side-by-side bar chart, where an example is shown in Figure 2.40(b). For the last type of bar chart we introduce, the column proportions for the app type and homeownership contingency table have been translated into a standardized segmented bar chart in Figure 2.40(c). This type of visualization is helpful in understanding the fraction of individual or joint loan applications for borrowers in each level of homeownership. Additionally, since the proportions of joint and individual vary across the groups, we can conclude that the two variables are associated. (a) (b) (c) (d) (a) segmented bar chart for homeownership, where the counts Figure 2.40: (b) Side-by-side bar chart for have been further broken down by app type. homeownership and app type. (c) Standardized version of the segmented bar chart. (d) Standardized side-by-side bar chart. See these bar charts on Tableau Public. rentmortgageown01000200030004000jointindividualFrequencyrentmortgageown01000200030004000jointindividualFrequencyrentmortgageown0.00.
|
20.40.60.81.0jointindividualProportionrentmortgageown0.00.20.40.60.81.0Proportionjointindividual 120 CHAPTER 2. SUMMARIZING DATA EXAMPLE 2.79 Examine the four bar charts in Figure 2.40. When is the segmented, side-by-side, standardized segmented bar chart, or standardized side-by-side the most useful? The segmented bar chart is most useful when it’s reasonable to assign one variable as the explanatory variable and the other variable as the response, since we are effectively grouping by one variable first and then breaking it down by the others. Side-by-side bar charts are more agnostic in their display about which variable, if any, represents the explanatory and which the response variable. It is also easy to discern the number of cases in of the six different group combinations. However, one downside is that it tends to require more horizontal space; the narrowness of Figure 2.40(b) makes the plot feel a bit cramped. Additionally, when two groups are of very different sizes, as we see in the own group relative to either of the other two groups, it is difficult to discern if there is an association between the variables. The standardized segmented bar chart is helpful if the primary variable in the segmented bar chart is relatively imbalanced, e.g. the own category has only a third of the observations in the mortgage category, making the simple segmented bar chart less useful for checking for an association. The major downside of the standardized version is that we lose all sense of how many cases each of the bars represents. The last plot is a standardized side-by-side bar chart. It shows the joint and individual groups as proportions within each level of homeownership, and it offers similar benefits and tradeoffs to the standardized version of the stacked bar plot. 2.4.4 Mosaic plots A mosaic plot is a visualization technique suitable for contingency tables that resembles a standardized segmented bar chart with the benefit that we still see the relative group sizes of the primary variable as well. To get started in creating our first mosaic plot, we’ll break a square into columns for each category of the homeownership variable, with the result shown in
|
Figure 2.41(a). Each column represents a level of homeownership, and the column widths correspond to the proportion of loans in each of those categories. For instance, there are fewer loans where the borrower is an owner than where the borrower has a mortgage. In general, mosaic plots use box areas to represent the number of cases in each category. (a) (b) Figure 2.41: (a) The one-variable mosaic plot for homeownership. (b) Two-variable mosaic plot for both homeownership and app type. To create a completed mosaic plot, the single-variable mosaic plot is further divided into pieces in Figure 2.41(b) using the app type variable. Each column is split proportional to the number of loans from individual and joint borrowers. For example, the second column represents loans where the borrower has a mortgage, and it was divided into individual loans (upper) and joint loans (lower). As another example, the bottom segment of the third column represents loans where the borrower owns their home and applied jointly, while the upper segment of this column represents borrowers who are homeowners and filed individually. We can again use this plot to see that the homeownership and app type variables are associated, since some columns are divided in different vertical locations than others, which was the same technique used for checking an association in the standardized segmented bar chart. rentmortgageownrentmortgageownjointindiv. 2.4. CONSIDERING CATEGORICAL DATA 121 In Figure 2.42, we chose to first split by the homeowner status of the borrower. However, we could have instead first split by the application type, as in Figure 2.42. Like with the bar charts, it’s common to use the explanatory variable to represent the first split in a mosaic plot, and then for the response to break up each level of the explanatory variable, if these labels are reasonable to attach to the variables under consideration. Figure 2.42: Mosaic plot where loans are grouped by the homeownership variable after they’ve been divided into the individual and joint application types. 2.4.5 The only pie chart you will see in this book A pie chart is shown in Figure 2.43 alongside a bar chart representing the same information. Pie charts can be useful for giving a high-level overview to show how a set of cases break down. However,
|
it is also difficult to decipher details in a pie chart. For example, it takes a couple seconds longer to recognize that there are more loans where the borrower has a mortgage than rent when looking at the pie chart, while this detail is very obvious in the bar chart. While pie charts can be useful, we prefer bar charts for their ease in comparing groups. Figure 2.43: A pie chart and bar chart of homeownership. Compare multiple ways of summarizing a single categorical variable on Tableau Public. indiv.jointrentmortgageownrentmortgageownrentmortgageownHomeownership01000200030004000Frequency 122 CHAPTER 2. SUMMARIZING DATA Section summary • Categorical variables, unlike numerical variables, are simply summarized by counts (how many) and proportions. These are referred to as frequency and relative frequency, respectively. • When summarizing one categorical variable, a one-way frequency table is useful. For summarizing two categorical variables and their relationship, use a two-way frequency table (also known as a contingency table). • To graphically summarize a single categorical variable, use a bar chart. To summarize and compare two categorical variables, use a side-by-side bar chart, a segmented bar chart, or a mosaic plot. • Pie charts are another option for summarizing categorical data, but they are more difficult to read and bar charts are generally a better option. 2.4. CONSIDERING CATEGORICAL DATA 123 Exercises 2.37 Antibiotic use in children. The bar plot and the pie chart below show the distribution of pre-existing medical conditions of children involved in a study on the optimal duration of antibiotic use in treatment of tracheitis, which is an upper respiratory infection. (a) What features are apparent in the bar plot but not in the pie chart? (b) What features are apparent in the pie chart but not in the bar plot? (c) Which graph would you prefer to use for displaying these categorical data? 2.38 Views on immigration. 910 randomly sampled registered voters from Tampa, FL were asked if they thought undocumented workers in the US should be (i) allowed to keep their jobs and apply for US citizenship, (ii) allowed to keep their jobs as temporary guest workers but not allowed to apply for US citizenship, or (iii) lose their jobs and have to leave the country. The results of the survey by
|
political ideology are shown below.58 Political ideology Conservative Moderate Response (i) Apply for citizenship (ii) Guest worker (iii) Leave the country (iv) Not sure Total 57 121 179 15 372 120 113 126 4 363 Liberal Total 278 262 350 20 910 101 28 45 1 175 (a) What percent of these Tampa, FL voters identify themselves as conservatives? (b) What percent of these Tampa, FL voters are in favor of the citizenship option? (c) What percent of these Tampa, FL voters identify themselves as conservatives and are in favor of the citizenship option? (d) What percent of these Tampa, FL voters who identify themselves as conservatives are also in favor of the citizenship option? What percent of moderates share this view? What percent of liberals share this view? (e) Do political ideology and views on immigration appear to be independent? Explain your reasoning. 58SurveyUSA, News Poll #18927, data collected Jan 27-29, 2012. GastrointestinalImmunocompromisedGenetic/metabolicNeuromuscularTraumaRespiratoryCardiovascularPrematurityRelative frequency0.000.100.200.30GastrointestinalImmunocompromisedGenetic/metabolicNeuromuscularTraumaRespiratoryCardiovascularPrematurity 124 CHAPTER 2. SUMMARIZING DATA 2.39 Views on the DREAM Act. A random sample of registered voters from Tampa, FL were asked if they support the DREAM Act, a proposed law which would provide a path to citizenship for people brought illegally to the US as children. The survey also collected information on the political ideology of the respondents. Based on the mosaic plot shown below, do views on the DREAM Act and political ideology appear to be independent? Explain your reasoning.59 2.40 Raise taxes. A random sample of registered voters nationally were asked whether they think it’s better to raise taxes on the rich or raise taxes on the poor. The survey also collected information on the political party affiliation of the respondents. Based on the mosaic plot shown below, do views on raising taxes and political affiliation appear to be independent? Explain your reasoning.60 59SurveyUSA, News Poll #18927, data collected Jan 27-29, 2012. 60Public Policy Polling, Americans on College Degrees, Classic Literature, the Seasons, and More, data collected Feb 20-22, 2015. ConservativeModerateLiberalSupportNot
|
supportNot sureDemocratRepublicanIndep / OtherRaise taxes on the richRaise taxes on the poorNot sure 2.5. CASE STUDY: MALARIA VACCINE (SPECIAL TOPIC) 125 2.5 Case study: malaria vaccine (special topic) How large does an observed difference need to be for it to provide convincing evidence that something real is going on, something beyond random variation? Answering this question requires the tools that we will encounter in the later chapters on probability and inference. However, this is such an interesting and important question, and we’ll also address it here using simulation. This section can be covered now or in tandem with Chapter 5: Foundations for Inference. Learning objectives 1. Recognize that an observed difference in sample statistics may be due to random chance and that we use hypothesis testing to determine if this difference statistically significant (i.e. too large to be attributed to random chance). 2. Set up competing hypotheses and use the results of a simulation to evaluate the degree of support the data provide against the null hypothesis and for the alternative hypothesis. 2.5.1 Variability within data EXAMPLE 2.80 Suppose your professor splits the students in class into two groups: students on the left and students on the right. If ˆpL and ˆpR represent the proportion of students who own an Apple product on the left and right, respectively, would you be surprised if ˆpL did not exactly equal ˆpR? While the proportions would probably be close to each other, it would be unusual for them to be exactly the same. We would probably observe a small difference due to chance. GUIDED PRACTICE 2.81 If we don’t think the side of the room a person sits on in class is related to whether the person owns an Apple product, what assumption are we making about the relationship between these two variables?61 We consider a study on a new malaria vaccine called PfSPZ. In this study, volunteer patients were randomized into one of two experiment groups: 14 patients received an experimental vaccine or 6 patients received a placebo vaccine. Nineteen weeks later, all 20 patients were exposed to a drug-sensitive malaria parasite strain; the motivation of using a drug-sensitive strain of parasite here is for ethical considerations, allowing any infections to be treated effect
|
ively. The results are summarized in Figure 2.44, where 9 of the 14 treatment patients remained free of signs of infection while all of the 6 patients in the control group patients showed some baseline signs of infection. 61We would be assuming that these two variables are independent. 126 CHAPTER 2. SUMMARIZING DATA treatment outcome vaccine placebo Total infection 5 6 11 no infection Total 14 6 20 9 0 9 Figure 2.44: Summary results for the malaria vaccine experiment. GUIDED PRACTICE 2.82 Is this an observational study or an experiment? What implications does the study type have on what can be inferred from the results?62 In this study, a smaller proportion of patients who received the vaccine showed signs of an infection (35.7% versus 100%). However, the sample is very small, and it is unclear whether the difference provides convincing evidence that the vaccine is effective. EXAMPLE 2.83 Data scientists are sometimes called upon to evaluate the strength of evidence. When looking at the rates of infection for patients in the two groups in this study, what comes to mind as we try to determine whether the data show convincing evidence of a real difference? The observed infection rates (35.7% for the treatment group versus 100% for the control group) suggest the vaccine may be effective. However, we cannot be sure if the observed difference represents the vaccine’s efficacy or is just from random chance. Generally there is a little bit of fluctuation in sample data, and we wouldn’t expect the sample proportions to be exactly equal, even if the truth was that the infection rates were independent of getting the vaccine. Additionally, with such small samples, perhaps it’s common to observe such large differences when we randomly split a group due to chance alone! Example 2.83 is a reminder that the observed outcomes in the data sample may not perfectly reflect the true relationships between variables since there is random noise. While the observed difference in rates of infection is large, the sample size for the study is small, making it unclear if this observed difference represents efficacy of the vaccine or whether it is simply due to chance. We label these two competing claims, H0 and HA, which are spoken as “H-nought” and “H
|
-A”: H0: Independence model. The variables treatment and outcome are independent. They have no relationship, and the observed difference between the proportion of patients who developed an infection in the two groups, 64.3%, was due to chance. HA: Alternative model. The variables are not independent. The difference in infection rates of 64.3% was not due to chance, and vaccine affected the rate of infection. What would it mean if the independence model, which says the vaccine had no influence on the rate of infection, is true? It would mean 11 patients were going to develop an infection no matter which group they were randomized into, and 9 patients would not develop an infection no matter which group they were randomized into. That is, if the vaccine did not affect the rate of infection, the difference in the infection rates was due to chance alone in how the patients were randomized. Now consider the alternative model: infection rates were influenced by whether a patient received the vaccine or not. If this was true, and especially if this influence was substantial, we would expect to see some difference in the infection rates of patients in the groups. We choose between these two competing claims by assessing if the data conflict so much with H0 that the independence model cannot be deemed reasonable. If this is the case, and the data support HA, then we will reject the notion of independence and conclude there was discrimination. 62The study is an experiment, as patients were randomly assigned an experiment group. Since this is an experiment, the results can be used to evaluate a causal relationship between the malaria vaccine and whether patients showed signs of an infection. 2.5. CASE STUDY: MALARIA VACCINE (SPECIAL TOPIC) 127 2.5.2 Simulating the study We’re going to implement simulations, where we will pretend we know that the malaria vaccine being tested does not work. Ultimately, we want to understand if the large difference we observed is common in these simulations. If it is common, then maybe the difference we observed was purely due to chance. If it is very uncommon, then the possibility that the vaccine was helpful seems more plausible. Figure 2.44 shows that 11 patients developed infections and 9 did not. For our simulation, we will suppose the
|
infections were independent of the vaccine and we were able to rewind back to when the researchers randomized the patients in the study. If we happened to randomize the patients differently, we may get a different result in this hypothetical world where the vaccine doesn’t influence the infection. Let’s complete another randomization using a simulation. In this simulation, we take 20 notecards to represent the 20 patients, where we write down “infection” on 11 cards and “no infection” on 9 cards. In this hypothetical world, we believe each patient that got an infection was going to get it regardless of which group they were in, so let’s see what happens if we randomly assign the patients to the treatment and control groups again. We thoroughly shuffle the notecards and deal 14 into a vaccine pile and 6 into a placebo pile. Finally, we tabulate the results, which are shown in Figure 2.45. outcome treatment (simulated) vaccine placebo Total infection 7 4 11 no infection Total 14 6 20 7 2 9 Figure 2.45: Simulation results, where any difference in infection rates is purely due to chance. GUIDED PRACTICE 2.84 What is the difference in infection rates between the two simulated groups in Figure 2.45? How does this compare to the observed 64.3% difference in the actual data?63 2.5.3 Checking for independence We computed one possible difference under the independence model in Guided Practice 2.84, which represents one difference due to chance. While in this first simulation, we physically dealt out notecards to represent the patients, it is more efficient to perform this simulation using a computer. Repeating the simulation on a computer, we get another difference due to chance: And another: 2 6 3 6 − 9 14 − 8 14 = −0.310 = −0.071 And so on until we repeat the simulation enough times that we have a good idea of what represents the distribution of differences from chance alone. Figure 2.46 shows a stacked plot of the differences found from 100 simulations, where each dot represents a simulated difference between the infection rates (control rate minus treatment rate). Note that the
|
distribution of these simulated differences is centered around 0. We simulated these differences assuming that the independence model was true, and under this condition, we expect the difference to be near zero with some random fluctuation, where near is pretty generous in this case since the sample sizes are so small in this study. 634/6 − 7/14 = 0.167 or about 16.7% in favor of the vaccine. This difference due to chance is much smaller than the difference observed in the actual groups. 128 CHAPTER 2. SUMMARIZING DATA Figure 2.46: A stacked dot plot of differences from 100 simulations produced under the independence model, H0, where in these simulations infections are unaffected by the vaccine. Two of the 100 simulations had a difference of at least 64.3%, the difference observed in the study. EXAMPLE 2.85 Given the results of the simulation shown in Figure 2.46, about how often would you expect to observe a result as large as 64.3% if H0 were true? Because a result this large happened 2 times out the 100 simulations, we would expect such a large value only 2% of the time if H0 were true. There are two possible interpretations of the results of the study: H0 Independence model. The vaccine has no effect on infection rate, and we just happened to observe a rare event. HA Alternative model. The vaccine has an effect on infection rate, and the difference we observed was actually due to the vaccine being effective at combatting malaria, which explains the large difference of 64.3%. Based on the simulations, we have two options. (1) We conclude that the study results do not provide strong enough evidence against the independence model, meaning we do not conclude that the vaccine had an effect in this clinical setting. (2) We conclude the evidence is sufficiently strong to reject H0, and we assert that the vaccine was useful. Is 2% small enough to make us reject the independence model? That depends on how much evidence we require. The smaller that probability is, the more evidence it provides against H0. Later, we will see that researchers often use a cutoff of 5
|
%, though it can depend upon the situation. Using the 5% cutoff, we would reject the independence model in favor of the alternative. That is, we are concluding the data provide strong evidence that the vaccine provides some protection against malaria in this clinical setting. When there is strong enough evidence that the result points to a real difference and is not simply due to random variation, we call the result statistically significant. One field of statistics, statistical inference, is built on evaluating whether such differences are due to chance. In statistical inference, data scientists evaluate which model is most reasonable given the data. Errors do occur, just like rare events, and we might choose the wrong model. While we do not always choose correctly, statistical inference gives us tools to control and evaluate how often these errors occur. In Chapter 5, we give a formal introduction to the problem of model selection. We spend the next two chapters building a foundation of probability and theory necessary to make that discussion rigorous. llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllDifference in Infection Rates−0.6−0.4−0.20.00.20.40.60.8 2.5. CASE STUDY: MALARIA VACCINE (SPECIAL TOPIC) 129 Exercises 2.41 Side effects of Avandia. Rosiglitazone is the active ingredient in the controversial type 2 diabetes medicine Avandia and has been linked to an increased risk of serious cardiovascular problems such as stroke, heart failure, and death. A common alternative treatment is pioglitazone, the active ingredient in a diabetes medicine called Actos. In a nationwide retrospective observational study of 227,571 Medicare beneficiaries aged 65 years or older, it was found that 2,593 of the 67,593 patients using rosiglitazone and 5,386 of the 159,978 using pioglitazone had serious cardiovascular problems. These data are summarized in the contingency table below.64 Treatment Rosiglitazone Pioglitazone Total Cardiovascular problems Yes 2,593 5,386 7,979 No 65,000 154,592 219,592 Total 67,593 159,978 227,571
|
(a) Determine if each of the following statements is true or false. If false, explain why. Be careful: The In such cases, the statement reasoning may be wrong even if the statement’s conclusion is correct. should be considered false. i. Since more patients on pioglitazone had cardiovascular problems (5,386 vs. 2,593), we can conclude that the rate of cardiovascular problems for those on a pioglitazone treatment is higher. ii. The data suggest that diabetic patients who are taking rosiglitazone are more likely to have cardiovascular problems since the rate of incidence was (2,593 / 67,593 = 0.038) 3.8% for patients on this treatment, while it was only (5,386 / 159,978 = 0.034) 3.4% for patients on pioglitazone. iii. The fact that the rate of incidence is higher for the rosiglitazone group proves that rosiglitazone causes serious cardiovascular problems. iv. Based on the information provided so far, we cannot tell if the difference between the rates of incidences is due to a relationship between the two variables or due to chance. (b) What proportion of all patients had cardiovascular problems? (c) If the type of treatment and having cardiovascular problems were independent, about how many patients in the rosiglitazone group would we expect to have had cardiovascular problems? (d) We can investigate the relationship between outcome and treatment in this study using a randomization technique. While in reality we would carry out the simulations required for randomization using statistical software, suppose we actually simulate using index cards. In order to simulate from the independence model, which states that the outcomes were independent of the treatment, we write whether or not each patient had a cardiovascular problem on cards, shuffled all the cards together, then deal them into two groups of size 67,593 and 159,978. We repeat this simulation 1,000 times and each time record the number of people in the rosiglitazone group who had cardiovascular problems. Use the relative frequency histogram of these counts to answer (i)-(iii). i. What are the claims being tested? ii. Compared to the number calculated in part (c), which would provide more support for the alternative hypothesis, more or fewer patients with cardiovascular problems in the rosiglitazone group? iii. What
|
do the simulation results suggest about the relationship between taking rosiglitazone and having cardiovascular problems in diabetic patients? 64D.J. Graham et al. “Risk of acute myocardial infarction, stroke, heart failure, and death in elderly Medicare patients treated with rosiglitazone or pioglitazone”. In: JAMA 304.4 (2010), p. 411. issn: 0098-7484. Simulated rosiglitazone cardiovascular events22502350245000.10.2 130 CHAPTER 2. SUMMARIZING DATA 2.42 Heart transplants. The Stanford University Heart Transplant Study was conducted to determine whether an experimental heart transplant program increased lifespan. Each patient entering the program was designated an official heart transplant candidate, meaning that he was gravely ill and would most likely benefit from a new heart. Some patients got a transplant and some did not. The variable transplant indicates which group the patients were in; patients in the treatment group got a transplant and those in the control group did not. Of the 34 patients in the control group, 30 died. Of the 69 people in the treatment group, 45 died. Another variable called survived was used to indicate whether or not the patient was alive at the end of the study.65 (a) Based on the mosaic plot, is survival independent of whether or not the patient got a transplant? Explain your reasoning. (b) What do the box plots below suggest about the efficacy (effectiveness) of the heart transplant treatment. (c) What proportion of patients in the treatment group and what proportion of patients in the control group died? (d) One approach for investigating whether or not the treatment is effective is to use a randomization technique. i. What are the claims being tested? ii. The paragraph below describes the set up for such approach, if we were to do it without using statistical software. Fill in the blanks with a number or phrase, whichever is appropriate. cards representing patients who were alive at the end of cards representing patients who were not. Then, We write alive on the study, and dead on we shuffle these cards and split them into two groups: one group of size representing control. We representing treatment, and another group of size calculate the difference between the proportion of dead cards in the treatment and control groups
|
(treatment - control) and record this value. We repeat this 100 times to build a. Lastly, we calculate the fraction of simulations distribution centered at. If this fraction is low, where the simulated differences in proportions are we conclude that it is unlikely to have observed such an outcome by chance and that the null hypothesis should be rejected in favor of the alternative. iii. What do the simulation results shown below suggest about the effectiveness of the transplant pro- gram? 65B. Turnbull et al. “Survivorship of Heart Transplant Data”. In: Journal of the American Statistical Association 69 (1974), pp. 74–80. controltreatmentalivedeadSurvival Time (days)controltreatment050010001500simulated differences in proportions−0.25−0.15−0.050.050.150.25llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
|
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll 2.5. CASE STUDY: MALARIA VACCINE (SPECIAL TOPIC) 131 Chapter highlights A raw data matrix/table may have thousands of rows. The data need to be summarized in order to makes sense of all the information. In this chapter, we looked at ways to summarize data graphically, numerically, and verbally. Categorical data • A single categorical variable is summarized with counts or proportionsproportion in a one-way table. A bar chart is used to show the frequency or relative frequency of the categories that the variable takes on. • Two categorical variables can be summarized in a two-way table and with a side-by-side bar chart or a segmented bar chart. Numerical data • When looking at a single numerical variable, we try to understand the distribution of the variable. The distribution of a variable can be represented with
|
a frequency table and with a graph, such as a stem-and-leaf plot or dot plot for small data sets, or a histogram for larger data sets. If only a summary is desired, a box plot may be used. • The distribution of a variable can be described and summarized with center (mean or median), spread (SD or IQR), and shape (right skewed, left skewed, approximately symmetric). • Z-scores and percentiles are useful for identifying a data point’s relative position within a data set. • When a distribution is nearly normal, we can use the empirical rule (68-95-99.7 rule), and we can use a normal model to approximate the histogram. • Outliers are values that appear extreme relative to the rest of the data. Investigating outliers can provide insight into properties of the data or may reveal data collection/entry errors. • When comparing the distribution of two variables, use two dot plots, two histograms, a back-to- back stem-and-leaf, or parallel box plots. • To look at the association between two numerical variables, use a scatterplot. Graphs and numbers can summarize data, but they alone are insufficient. It is the role of the researcher or data scientist to ask questions, to use these tools to identify patterns and departure from patterns, and to make sense of this in the context of the data. Strong writing skills are critical for being able to communicate the results to a wider audience. 132 CHAPTER 2. SUMMARIZING DATA Chapter exercises In a class of 25 students, 24 of them took an exam in class and 1 student took 2.43 Make-up exam. a make-up exam the following day. The professor graded the first batch of 24 exams and found an average score of 74 points with a standard deviation of 8.9 points. The student who took the make-up the following day scored 64 points on the exam. (a) Does the new student’s score increase or decrease the average score? (b) What is the new average? (c) Does the new student’s score increase or decrease the standard deviation of the scores? 2.44 Infant mortality. The infant mortality rate is defined as the number of infant deaths per 1,000 live births. This rate is often used as an indicator of the level of health in a country. The relative frequency histogram below shows
|
the distribution of estimated infant death rates for 224 countries for which such data were available in 2014.66 (a) Estimate Q1, the median, and Q3 from the histogram. (b) Would you expect the mean of this data set to be smaller or larger than the median? Explain your reasoning. 2.45 TV watchers. Students in an AP Statistics class were asked how many hours of television they watch per week (including online streaming). This sample yielded an average of 4.71 hours, with a standard deviation of 4.18 hours. Is the distribution of number of hours students watch television weekly symmetric? If not, what shape would you expect this distribution to have? Explain your reasoning. 2.46 A new statistic. The statistic median can be used as a measure of skewness. Suppose we have a distribution where all observations are greater than 0, xi > 0. What is the expected shape of the distribution under the following conditions? Explain your reasoning. ¯x (a) (b) (c) ¯x ¯x median = 1 median < 1 median > 1 ¯x 2.47 Oscar winners. The first Oscar awards for best actor and best actress were given out in 1929. The histograms below show the age distribution for all of the best actor and best actress winners from 1929 to 2018. Summary statistics for these distributions are also provided. Compare the distributions of ages of best actor and actress winners.67 Mean SD n Best Actress 36.2 11.9 92 Mean SD n Best Actor 43.8 8.83 92 66CIA Factbook, Country Comparisons, 2014. 67Oscar winners from 1929 – 2012, data up to 2009 from the Journal of Statistics Education data archive and more current data from wikipedia.org. Infant Mortality (per 1000 Live Births)Fraction of Countries02040608010012000.10.20.30.4Best actorBest actress204060800102030405001020304050Age (in years) 2.5. CASE STUDY: MALARIA VACCINE (SPECIAL TOPIC) 133 2.48 Exam scores. The average on a history exam (scored out of 100 points) was 85, with a standard deviation of 15. Is the distribution of the scores on this exam symmetric? If not, what shape would you expect this distribution to have? Explain your reasoning. 2.49 Stats scores. Below are the final
|
exam scores of twenty introductory statistics students. 57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94 Create a box plot of the distribution of these scores. The five number summary provided below may be useful. Min Q1 Q2 (Median) Q3 Max 57 72.5 78.5 82.5 94 2.50 Marathon winners. The histogram and box plots below show the distribution of finishing times for male and female winners of the New York Marathon between 1970 and 1999. (a) What features of the distribution are apparent in the histogram and not the box plot? What features are apparent in the box plot but not in the histogram? (b) What may be the reason for the bimodal distribution? Explain. (c) Compare the distribution of marathon times for men and women based on the box plot shown below. (d) The time series plot shown below is another way to look at these data. Describe what is visible in this plot but not in the others. 2.02.42.83.201020Marathon times2.02.42.83.22.02.42.83.2WomenMenllllllllllllllllllllllllllllllMarathon times19701975198019851990199520002.02.42.83.2lWomenMen 134 CHAPTER 2. SUMMARIZING DATA 2.51 Birth weight. In a large study of birth weight of newborns, the weights of 23,419 newborn boys were recorded. The distribution of weights was approximately normal with a mean of 7.44 lbs (3376 grams) and a standard deviation of 1.33 lbs (603 grams). The government classifies a newborn as having low birth weight if the weight is less than 5.5 pounds.68 (a) What percent of these newborns had a low birth weight? (b) Approximately what percent of these babies weighed greater than 10 pounds? (c) Approximately how many of these newborns weighed greater than 10 pounds? (d) How much would a newborn have to weigh in order to be at the 90th percentile among this group? 2.52 Auto insurance premiums. Suppose a newspaper article states that the distribution of auto insurance premiums for residents of California is approximately normal with a mean of $1,
|
650. The article also states that 25% of California residents pay more than $1,800. (a) What is the Z-score that corresponds to the top 25% (or the 75th percentile) of the standard normal distribution? (b) What is the mean insurance cost? What is the cutoff for the 75th percentile? (c) Identify the standard deviation of insurance premiums in California. 2.53 Speeding on the I-5, Part I. The distribution of passenger vehicle speeds traveling on the Interstate 5 Freeway (I-5) in California is nearly normal with a mean of 72.6 miles/hour and a standard deviation of 4.78 miles/hour.69 (a) What percent of passenger vehicles travel slower than 80 miles/hour? (b) What percent of passenger vehicles travel between 60 and 80 miles/hour? (c) How fast do the fastest 5% of passenger vehicles travel? (d) The speed limit on this stretch of the I-5 is 70 miles/hour. Approximate what percentage of the passenger vehicles travel above the speed limit on this stretch of the I-5. 2.54 Heights of 10 year olds, Part I. Heights of 10 year olds, regardless of gender, closely follow a normal distribution with mean 55 inches and standard deviation 6 inches. (a) What is the probability that a randomly chosen 10 year old is shorter than 48 inches? (b) What is the probability that a randomly chosen 10 year old is between 60 and 65 inches? (c) If the tallest 10% of the class is considered “very tall”, what is the height cutoff for “very tall”? 68www.biomedcentral.com/1471-2393/8/5 69S. Johnson and D. Murray. “Empirical Analysis of Truck and Automobile Speeds on Rural Interstates: Impact of Posted Speed Limits”. In: Transportation Research Board 89th Annual Meeting. 2010. 135 Chapter 3 Probability and probability distributions 3.1 Defining probability 3.2 Conditional probability 3.3 Simulations 3.4 Random variables 3.5 Geometric distribution 3.6 Binomial distribution 136 Probability forms a foundation of statistics, and you’re probably already aware of many of the ideas. However, formalization of the concepts is new for most. This chapter aims to introduce probability concepts through examples that will be
|
familiar to most people. For videos, slides, and other resources, please visit www.openintro.org/ahss 3.1. DEFINING PROBABILITY 137 3.1 Defining probability What is the probability of rolling an even number on a die? Of getting 5 heads in row when tossing a coin? Of drawing a Heart or an Ace from a deck of cards? The study of probability is fun and interesting in its own right, but it also forms the foundation for statistical models and inferential procedures, many of which we will investigate in subsequent chapters. Learning objectives 1. Describe the long-run relative frequency interpretation of probability and understand its rela- tionship to the “Law of Large Numbers”. 2. Use Venn diagrams to represent events and their probabilities and to visualize the complement, union, and intersection of events. 3. Use the General Addition Rule to find the probability that at least one of several events occurs. 4. Understand when events are disjoint (mutually exclusive) and how that simplifies the General Addition Rule. 5. Apply the Multiplication Rule for finding the joint probability of independent events. 3.1.1 Introductory examples EXAMPLE 3.1 A “die”, the singular of dice, is a cube with six faces numbered 1, 2, 3, 4, 5, and 6. What is the chance of getting 1 when rolling a die? If the die is fair, then the chance of a 1 is as good as the chance of any other number. Since there are six outcomes, the chance must be 1-in-6 or, equivalently, 1/6. EXAMPLE 3.2 What is the chance of getting a 1 or 2 in the next roll? 1 and 2 constitute two of the six equally likely possible outcomes, so the chance of getting one of these two outcomes must be 2/6 = 1/3. EXAMPLE 3.3 What is the chance of getting either 1, 2, 3, 4, 5, or 6 on the next roll? 100%. The outcome must be one of these numbers. EXAMPLE 3.4 What is the chance of not rolling a 2? Since the chance of rolling a 2 is 1/6 or 16.¯6%, the chance of not rolling a 2 must be 100% − 16.¯6% = 83.¯3% or
|
5/6. Alternatively, we could have noticed that not rolling a 2 is the same as getting a 1, 3, 4, 5, or 6, which makes up five of the six equally likely outcomes and has probability 5/6. 138 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS EXAMPLE 3.5 Consider rolling two dice. If 1/6th of the time the first die is a 1 and 1/6th of those times the second die is a 1, what is the chance of getting two 1s? If 16.¯6% of the time the first die is a 1 and 1/6th of those times the second die is also a 1, then the chance that both dice are 1 is (1/6) × (1/6) or 1/36. 3.1.2 Probability We use probability to build tools to describe and understand apparent randomness. We often frame probability in terms of a random process giving rise to an outcome. Roll a die → 1, 2, 3, 4, 5, or 6 Flip a coin → H or T Rolling a die or flipping a coin is a seemingly random process and each gives rise to an outcome. PROBABILITY The probability of an outcome is the proportion of times the outcome would occur if we observed the random process an infinite number of times. Probability is defined as a proportion, and it always takes values between 0 and 1 (inclusively). It may also be displayed as a percentage between 0% and 100%. Probability can be illustrated by rolling a die many times. Consider the event “roll a 1”. The relative frequency of an event is the proportion of times the event occurs out of the number of trials. Let ˆpn be the proportion of outcomes that are 1 after the first n rolls. As the number of rolls increases, ˆpn (the relative frequency of rolls) will converge to the probability of rolling a 1, p = 1/6. Figure 3.1 shows this convergence for 100,000 die rolls. The tendency of ˆpn to stabilize around p, that is, the tendency of the relative frequency to stabilize around the true probability, is described by the Law of Large Numbers. Figure 3.1: The fraction of die rolls that are 1 at each stage in a simulation. The
|
relative frequency tends to get closer to the probability 1/6 ≈ 0.167 as the number of rolls increases. LAW OF LARGE NUMBERS As more observations are collected, the observed proportion ˆpn of occurrences with a particular outcome after n trials converges to the true probability p of that outcome. n (number of rolls)1101001,00010,000100,0000.000.050.100.150.200.250.30p^n 3.1. DEFINING PROBABILITY 139 Occasionally the proportion will veer off from the probability and appear to defy the Law of Large Numbers, as ˆpn does many times in Figure 3.1. However, these deviations become smaller as the number of rolls increases. Above we write p as the probability of rolling a 1. We can also write this probability as P (rolling a 1) As we become more comfortable with this notation, we will abbreviate it further. For instance, if it is clear that the process is “rolling a die”, we could abbreviate P (rolling a 1) as P (1). GUIDED PRACTICE 3.6 Random processes include rolling a die and flipping a coin. (a) Think of another random process. (b) Describe all the possible outcomes of that process. For instance, rolling a die is a random process with potential outcomes 1, 2,..., 6. 1 What we think of as random processes are not necessarily random, but they may just be too difficult to understand exactly. The fourth example in the footnote solution to Guided Practice 3.6 suggests a roommate’s behavior is a random process. However, even if a roommate’s behavior is not truly random, modeling her behavior as a random process can still be useful. MODELING A PROCESS AS RANDOM It can be helpful to model a process as random even if it is not truly random. 3.1.3 Disjoint or mutually exclusive outcomes Two outcomes are called disjoint or mutually exclusive if they cannot both happen in the same trial. For instance, if we roll a die, the outcomes 1 and 2 are disjoint since they cannot both occur on a single roll. On the other hand, the outcomes 1 and “rolling an odd number” are not disjoint since both occur if the outcome of the roll is a 1. The terms disjoint and mutually
|
exclusive are equivalent and interchangeable. Calculating the probability of disjoint outcomes is easy. When rolling a die, the outcomes 1 and 2 are disjoint, and we compute the probability that one of these outcomes will occur by adding their separate probabilities: P (1 or 2) = P (1) + P (2) = 1/6 + 1/6 = 1/3 What about the probability of rolling a 1, 2, 3, 4, 5, or 6? Here again, all of the outcomes are disjoint so we add the probabilities: P (1 or 2 or 3 or 4 or 5 or 6) = P (1) + P (2) + P (3) + P (4) + P (5) + P (6) = 1/6 + 1/6 + 1/6 + 1/6 + 1/6 + 1/6 = 1. The Addition Rule guarantees the accuracy of this approach when the outcomes are disjoint. 1Here are four examples. (i) Whether someone gets sick in the next month or not is an apparently random process with outcomes sick and not. (ii) We can generate a random process by randomly picking a person and measuring that person’s height. The outcome of this process will be a positive number. (iii) Whether the stock market goes up or down next week is a seemingly random process with possible outcomes up, down, and no change. Alternatively, we could have used the percent change in the stock market as a numerical outcome. (iv) Whether your roommate cleans her dishes tonight probably seems like a random process with possible outcomes cleans dishes and leaves dishes. 140 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS ADDITION RULE OF DISJOINT OUTCOMES If A1 and A2 represent two disjoint outcomes, then the probability that one of them occurs is given by P (A1 or A2) = P (A1) + P (A2) If there are many disjoint outcomes A1,..., Ak, then the probability that one of these outcomes will occur is P (A1) + P (A2) + · · · + P (Ak) GUIDED PRACTICE 3.7 We are interested in the probability of rolling a 1, 4, or 5. (a) Explain why the outcomes 1, 4, and 5 are disjoint. (b) Apply the Addition Rule for dis
|
joint outcomes to determine P (1 or 4 or 5).2 GUIDED PRACTICE 3.8 In the email data set in Chapter 2, the number variable described whether no number (labeled none), only one or more small numbers (small), or whether at least one big number appeared in an email (big). Of the 3,921 emails, 549 had no numbers, 2,827 had only one or more small numbers, and 545 had at least one big number. (a) Are the outcomes none, small, and big disjoint? (b) Determine the proportion of emails with value small and big separately. (c) Use the Addition Rule for disjoint outcomes to compute the probability a randomly selected email from the data set has a number in it, small or big.3 Statisticians rarely work with individual outcomes and instead consider sets or collections of outcomes. Let A represent the event where a die roll results in 1 or 2 and B represent the event that the die roll is a 4 or a 6. We write A as the set of outcomes {1, 2} and B = {4, 6}. These sets are commonly called events. Because A and B have no elements in common, they are disjoint events. A and B are represented in Figure 3.2. Figure 3.2: Three events, A, B, and D, consist of outcomes from rolling a die. A and B are disjoint since they do not have any outcomes in common. The Addition Rule applies to both disjoint outcomes and disjoint events. The probability that one of the disjoint events A or B occurs is the sum of the separate probabilities: P (A or B) = P (A) + P (B) = 1/3 + 1/3 = 2/3 2(a) The random process is a die roll, and at most one of these outcomes can come up. This means they are disjoint outcomes. (b) P (1 or 4 or 5) = P (1) + P (4) + P (5) = 1 6 = 1 3(a) Yes. Each email is categorized in only one level of number. (b) Small: 2827 small or big) = P (small) + P (big) = 0.721 + 0.139 = 0.860. 3921 = 0.721. Big: 545 3921 =
|
0.139. (c) 123456ABD 3.1. DEFINING PROBABILITY 141 GUIDED PRACTICE 3.9 (a) Verify the probability of event A, P (A), is 1/3 using the Addition Rule. (b) Do the same for event B.4 GUIDED PRACTICE 3.10 (a) Using Figure 3.2 as a reference, what outcomes are represented by event D? (b) Are events B and D disjoint? (c) Are events A and D disjoint?5 GUIDED PRACTICE 3.11 In Guided Practice 3.10, you confirmed B and D from Figure 3.2 are disjoint. Compute the probability that either event B or event D occurs.6 3.1.4 Probabilities when events are not disjoint Let’s consider calculations for two events that are not disjoint in the context of a regular deck of 52 cards, represented in Figure 3.3. If you are unfamiliar with the cards in a regular deck, please see the footnote.7 2♣ 3♣ 4♣ 5♣ 6♣ 7♣ 8♣ 9♣ 10♣ J♣ Q♣ K♣ A♣ 2♦ 3♦ 4♦ 5♦ 6♦ 7♦ 8♦ 9♦ 10♦ J♦ Q♦ K♦ A♦ 2♥ 3♥ 4♥ 5♥ 6♥ 7♥ 8♥ 9♥ 10♥ J♥ Q♥ K♥ A♥ 2♠ 3♠ 4♠ 5♠ 6♠ 7♠ 8♠ 9♠ 10♠ J♠ Q♠ K♠ A♠ Figure 3.3: Representations of the 52 unique cards in a deck. GUIDED PRACTICE 3.12 (a) What is the probability that a randomly selected card is a diamond? (b) What is the probability that a randomly selected card is a face card?8 Venn diagrams are useful when outcomes can be categorized as “in” or “out” for two or three variables, attributes, or random processes. The Venn diagram in Figure 3.4 uses a circle to represent diamonds and another to represent face cards. If a card is both a diamond and a face card, it falls into the intersection of the circles. If it is a diamond but not a face
|
card, it will be in part of the left circle that is not in the right circle (and so on). The total number of cards that are diamonds is given by the total number of cards in the diamonds circle: 10 + 3 = 13. The probabilities are also shown (e.g. 10/52 = 0.1923). 4(a) P (A) = P (1 or 2) = P (1) + P (2) = 1 5(a) Outcomes 2 and 3. (b) Yes, events B and D are disjoint because they share no outcomes. (c) The events A 3. (b) Similarly, P (B) = 1/3 and D share an outcome in common, 2, and so are not disjoint. 6Since B and D are disjoint events, use the Addition Rule: P (B or D) = P (B) + P (D) = 1 7The 52 cards are split into four suits: ♣ (club), ♦ (diamond), ♥ (heart), ♠ (spade). Each suit has its 13 cards labeled: 2, 3,..., 10, J (jack), Q (queen), K (king), and A (ace). Thus, each card is a unique combination of a suit and a label, e.g. 4♥ and J♣. The 12 cards represented by the jacks, queens, and kings are called face cards. The cards that are ♦ or ♥ are typically colored red while the other two suits are typically colored black(a) There are 52 cards and 13 diamonds. If the cards are thoroughly shuffled, each card has an equal chance 52 = 0.250. (b) Likewise, of being drawn, so the probability that a randomly selected card is a diamond is P (♦) = 13 there are 12 face cards, so P (face card) = 12 52 = 3 13 = 0.231. 142 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Figure 3.4: A Venn diagram for diamonds and face cards. GUIDED PRACTICE 3.13 Using the Venn diagram, verify P (face card) = 12/52 = 3/13.9 Let A represent the event that a randomly selected card is a diamond and B represent the event that it is a face card. How do we compute P (A or
|
B)? Events A and B are not disjoint – the cards J♦, Q♦, and K♦ fall into both categories – so we cannot use the Addition Rule for disjoint events. Instead we use the Venn diagram. We start by adding the probabilities of the two events: P (A) + P (B) = P (♦) + P (face card) = 13/52 + 12/52 However, the three cards that are in both events were counted twice, once in each probability. We must correct this double counting: P (A or B) = P (♦) + P (face card) = P (♦) + P (face card) − P (♦ and face card) = 13/52 + 12/52 − 3/52 = 22/52 = 11/26 Equation (3.14) is an example of the General Addition Rule. GENERAL ADDITION RULE If A and B are any two events, disjoint or not, then the probability that A or B will occur is P (A or B) = P (A) + P (B) − P (A and B) where P (A and B) is the probability that both events occur. SYMBOLIC NOTATION FOR “AND” AND “OR” The symbol ∩ means intersection and is equivalent to “and”. The symbol ∪ means union and is equivalent to “or”. It is common to see the General Addition Rule written as P (A ∪ B) = P (A) + P (B) − P (A ∩ B) “OR” IS INCLUSIVE When we write, “or” in statistics, we mean “and/or” unless we explicitly state otherwise. Thus, A or B occurs means A, B, or both A and B occur. This is equivalent to at least one of A or B occurring. 9The Venn diagram shows face cards split up into “face card but not ♦” and “face card and ♦”. Since these 52 = 3 13. correspond to disjoint events, P (face card) is found by adding the two corresponding probabilities: 3 52 = 12 52 + 9 10390.19230.05770.1731There are also30 cards that areneither diamondsnor face cardsDiamonds, 0.2500Face cards, 0
|
.2308 3.1. DEFINING PROBABILITY 143 GUIDED PRACTICE 3.14 (a) If A and B are disjoint, describe why this implies P (A and B) = 0. (b) Using part (a), verify that the General Addition Rule simplifies to the simpler Addition Rule for disjoint events if A and B are disjoint.10 GUIDED PRACTICE 3.15 In the email data set with 3,921 emails, 367 were spam, 2,827 contained some small numbers but no big numbers, and 168 had both characteristics. Create a Venn diagram for this setup.11 GUIDED PRACTICE 3.16 (a) Use your Venn diagram from Guided Practice 3.15 to determine the probability a randomly drawn email from the email data set is spam and had small numbers (but not big numbers). (b) What is the probability that the email had either of these attributes?12 3.1.5 Complement of an event Rolling a die produces a value in the set {1, 2, 3, 4, 5, 6}. This set of all possible outcomes is called the sample space (S) for rolling a die. We often use the sample space to examine the scenario where an event does not occur. Let D = {2, 3} represent the event that the outcome of a die roll is 2 or 3. Then the complement represents all outcomes in our sample space that are not in D, which is denoted by Dc = {1, 4, 5, 6}. That is, Dc is the set of all possible outcomes not already included in D. Figure 3.5 shows the relationship between D, Dc, and the sample space S. Figure 3.5: Event D = {2, 3} and its complement, Dc = {1, 4, 5, 6}. S represents the sample space, which is the set of all possible events. GUIDED PRACTICE 3.17 (a) Compute P (Dc) = P (rolling a 1, 4, 5, or 6). (b) What is P (D) + P (Dc)?13 10(a) If A and B are disjoint, A and B can never occur simultaneously. (b) If A and B are disjoint, then the last term of Equation (3.14) is
|
0 (see part (a)) and we are left with the Addition Rule for disjoint events. 11Both the counts and corresponding probabilities (e.g. 2659/3921 = 0.678) are shown. Notice that the number of emails represented in the left circle corresponds to 2659 + 168 = 2827, and the number represented in the right circle is 168 + 199 = 367. 12(a) The solution is represented by the intersection of the two circles: 0.043. (b) This is the sum of the three disjoint probabilities shown in the circles: 0.678 + 0.043 + 0.051 = 0.772. 13(a) The outcomes are disjoint and each has probability 1/6, so the total probability is 4/6 = 2/3. (b) We can also see that P (D) = 1 6 + 1 6 = 1/3. Since D and Dc are disjoint, P (D) + P (Dc) = 1. 145623DDCSsmall numbers and no big numbersspam26591681990.6780.0430.051Other emails: 3921−2659−168−199 = 895(0.228) 144 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS GUIDED PRACTICE 3.18 Events A = {1, 2} and B = {4, 6} are shown in Figure 3.2 on page 140. (a) Write out what Ac and Bc represent. (b) Compute P (Ac) and P (Bc). (c) Compute P (A) + P (Ac) and P (B) + P (Bc).14 An event A together with its complement Ac comprise the entire sample space. Because of this we can say that P (A) + P (Ac) = 1. COMPLEMENT The complement of event A is denoted Ac, and Ac represents all outcomes not in A. A and Ac are mathematically related: P (A) + P (Ac) = 1, i.e. P (A) = 1 − P (Ac) In simple examples, computing A or Ac is feasible in a few steps. However, using the complement can save a lot of time as problems grow in complexity. GUIDED PRACTICE 3.19 A die is rolled 10 times. (a) What is the complement
|
of getting at least one 6 in 10 rolls of the die? (b) What is the complement of getting at most three 6’s in 10 rolls of the die?15 3.1.6 Independence Just as variables and observations can be independent, random processes can be independent, too. Two processes are independent if knowing the outcome of one provides no useful information about the outcome of the other. For instance, flipping a coin and rolling a die are two independent processes – knowing the coin was heads does not help determine the outcome of a die roll. On the other hand, stock prices usually move up or down together, so they are not independent. Example 3.5 provides a basic example of two independent processes: rolling two dice. We want to determine the probability that both will be 1. Suppose one of the dice is red and the other white. If the outcome of the red die is a 1, it provides no information about the outcome of the white die. We first encountered this same question in Example 3.5 (page 138), where we calculated the probability using the following reasoning: 1/6th of the time the red die is a 1, and 1/6th of those times the white die will also be 1. This is illustrated in Figure 3.6. Because the rolls are independent, the probabilities of the corresponding outcomes can be multiplied to get the final answer: (1/6) × (1/6) = 1/36. This can be generalized to many independent processes. Figure 3.6: 1/6th of the time, the first roll is a 1. Then 1/6th of those times, the second roll will also be a 1. 14Brief solutions: (a) Ac = {3, 4, 5, 6} and Bc = {1, 2, 3, 5}. (b) Noting that each outcome is disjoint, add the individual outcome probabilities to get P (Ac) = 2/3 and P (Bc) = 2/3. (c) A and Ac are disjoint, and the same is true of B and Bc. Therefore, P (A) + P (Ac) = 1 and P (B) + P (Bc) = 1. 15(a) The complement of getting at least one 6 in ten rolls of a die is getting zero 6’s in the 10 rolls. (b
|
) The complement of getting at most three 6’s in 10 rolls is getting four, five,..., nine, or ten 6’s in 10 rolls. All rolls1/6th of the firstrolls are a 1.1/6th of those times wherethe first roll is a 1 thesecond roll is also a 1. 3.1. DEFINING PROBABILITY 145 EXAMPLE 3.20 What if there was also a blue die independent of the other two? What is the probability of rolling the three dice and getting all 1s? The same logic applies from Example 3.5. If 1/36th of the time the white and red dice are both 1, then 1/6th of those times the blue die will also be 1, so multiply: P (white = 1 and red = 1 and blue = 1) = P (white = 1) × P (red = 1) × P (blue = 1) = (1/6) × (1/6) × (1/6) = 1/216 Examples 3.5 and 3.20 illustrate what is called the Multiplication Rule for independent pro- cesses. MULTIPLICATION RULE FOR INDEPENDENT PROCESSES If A and B represent events from two different and independent processes, then the probability that both A and B occur can be calculated as the product of their separate probabilities: P (A and B) = P (A) × P (B) Similarly, if there are k events A1,..., Ak from k independent processes, then the probability they all occur is P (A1) × P (A2) × · · · × P (Ak) GUIDED PRACTICE 3.21 About 9% of people are left-handed. Suppose 2 people are selected at random from the U.S. population. Because the sample size of 2 is very small relative to the population, it is reasonable to assume these two people are independent. (a) What is the probability that both are left-handed? (b) What is the probability that both are right-handed?16 GUIDED PRACTICE 3.22 Suppose 5 people are selected at random.17 (a) What is the probability that all are right-handed? (b) What is the probability that all are left-handed? (c) What is the probability that not all of the people are right
|
-handed? 16(a) The probability the first person is left-handed is 0.09, which is the same for the second person. We apply the Multiplication Rule for independent processes to determine the probability that both will be left-handed: 0.09×0.09 = 0.0081. (b) It is reasonable to assume the proportion of people who are ambidextrous (both right- and left-handed) is nearly 0, which results in P (right-handed) = 1 − 0.09 = 0.91. Using the same reasoning as in part (a), the probability that both will be right-handed is 0.91 × 0.91 = 0.8281. 17(a) The abbreviations RH and LH are used for right-handed and left-handed, respectively. Since each are indepen- dent, we apply the Multiplication Rule for independent processes: P (all five are RH) = P (first = RH, second = RH,..., fifth = RH) = P (first = RH) × P (second = RH) × · · · × P (fifth = RH) = 0.91 × 0.91 × 0.91 × 0.91 × 0.91 = 0.624 (b) Using the same reasoning as in (a), 0.09 × 0.09 × 0.09 × 0.09 × 0.09 = 0.0000059 (c) Use the complement, P (all five are RH), to answer this question: P (not all RH) = 1 − P (all RH) = 1 − 0.624 = 0.376 146 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Suppose the variables handedness and gender are independent, i.e. knowing someone’s gender provides no useful information about their handedness and vice-versa. Then we can compute whether a randomly selected person is right-handed and female18 using the Multiplication Rule: P (right-handed and female) = P (right-handed) × P (female) = 0.91 × 0.50 = 0.455 GUIDED PRACTICE 3.23 Three people are selected at random.19 (a) What is the probability that the first person is male
|
and right-handed? (b) What is the probability that the first two people are male and right-handed?. (c) What is the probability that the third person is female and left-handed? (d) What is the probability that the first two people are male and right-handed and the third person is female and left-handed? Sometimes we wonder if one outcome provides useful information about another outcome. The question we are asking is, are the occurrences of the two events independent? We say that two events A and B are independent if they satisfy Equation (3.21). EXAMPLE 3.24 If we shuffle up a deck of cards and draw one, is the event that the card is a heart independent of the event that the card is an ace? The probability the card is a heart is 1/4 and the probability that it is an ace is 1/13. The probability the card is the ace of hearts is 1/52. We check whether Equation 3.21 is satisfied: P (♥) × P (ace) = 1 4 × 1 13 = 1 52 = P (♥ and ace) Because the equation holds, the event that the card is a heart and the event that the card is an ace are independent events. 18The actual proportion of the U.S. population that is female is about 50%, and so we use 0.5 for the probability of sampling a woman. However, this probability does differ in other countries. 19Brief answers are provided. (a) This can be written in probability notation as P (a randomly selected person is male and right-handed) = 0.455. (b) 0.207. (c) 0.045. (d) 0.0093. 3.1. DEFINING PROBABILITY 147 Section summary • When an outcome depends upon a chance process, we can define the probability of the outcome as the proportion of times it would occur if we repeated the process an infinite number of times. Also, even when an outcome is not truly random, modeling it with probability can be useful. • The Law of Large Numbers states that the relative frequency, or proportion of times an outcome occurs after n repetitions, stabilizes around the true probability as n gets large. • The probability of an event is always between 0 and 1,
|
inclusive. • The probability of an event and the probability of its complement add up to 1. Sometime we use P (A) = 1 − P (not A) when P (not A) is easier to calculate than P (A). • A and B are disjoint, i.e. mutually exclusive, if they cannot happen together. In this case, the events do not overlap and P (A and B) = 0. • In the special case where A and B are disjoint events: P (A or B) = P (A) + P (B). • When A and B are not disjoint, adding P (A) and P (B) will overestimate P (A or B) because the overlap of A and B will be added twice. Therefore, when A and B are not disjoint, use the General Addition Rule: P (A or B) = P (A) + P (B) − P (A and B).20 • To find the probability that at least one of several events occurs, use a special case of the rule of complements: P (at least one) = 1 − P (none). • When only considering two events, the probability that one or the other happens is equal to the probability that at least one of the two events happens. When dealing with more than two events, the General Addition Rule becomes very complicated. Instead, to find the probability that A or B or C occurs, find the probability that none of them occur and subtract that value from 1. • Two events are independent when the occurrence of one does not change the likelihood of the other. • In the special case where A and B are independent: P (A and B) = P (A) × P (B). 20Often written: P (A ∪ B) = P (A) + P (B) − P (A ∩ B). 148 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Exercises 3.1 True or false. Determine if the statements below are true or false, and explain your reasoning. (a) If a fair coin is tossed many times and the last eight tosses are all heads, then the chance that the next toss will be heads is somewhat less than 50%. (b) Drawing a face card (jack, queen, or king) and drawing a red card from a full deck of playing
|
cards are mutually exclusive events. (c) Drawing a face card and drawing an ace from a full deck of playing cards are mutually exclusive events. 3.2 Roulette wheel. The game of roulette involves spinning a wheel with 38 slots: 18 red, 18 black, and 2 green. A ball is spun onto the wheel and will eventually land in a slot, where each slot has an equal chance of capturing the ball. (a) You watch a roulette wheel spin 3 consecutive times and the ball lands on a red slot each time. What is the probability that the ball will land on a red slot on the next spin? (b) You watch a roulette wheel spin 300 consecutive times and the ball lands on a red slot each time. What is the probability that the ball will land on a red slot on the next spin? (c) Are you equally confident of your answers to parts (a) and (b)? Why or why not? Photo by H˚akan Dahlstr¨om (http://flic.kr/p/93fEzp) CC BY 2.0 license Below are four versions of the same game. Your archnemesis gets to 3.3 Four games, one winner. pick the version of the game, and then you get to choose how many times to flip a coin: 10 times or 100 times. Identify how many coin flips you should choose for each version of the game. It costs $1 to play each game. Explain your reasoning. (a) If the proportion of heads is larger than 0.60, you win $1. (b) If the proportion of heads is larger than 0.40, you win $1. (c) If the proportion of heads is between 0.40 and 0.60, you win $1. (d) If the proportion of heads is smaller than 0.30, you win $1. 3.4 Backgammon. Backgammon is a board game for two players in which the playing pieces are moved according to the roll of two dice. Players win by removing all of their pieces from the board, so it is usually good to roll high numbers. You are playing backgammon with a friend and you roll two 6s in your first roll and two 6s in your second roll. Your friend rolls two 3s in his first roll and again in his second row.
|
Your friend claims that you are cheating, because rolling double 6s twice in a row is very unlikely. Using probability, show that your rolls were just as likely as his. 3.5 Coin flips. If you flip a fair coin 10 times, what is the probability of (a) getting all tails? (b) getting all heads? (c) getting at least one tails? 3.6 Dice rolls. If you roll a pair of fair dice, what is the probability of (a) getting a sum of 1? (b) getting a sum of 5? (c) getting a sum of 12? 3.1. DEFINING PROBABILITY 149 A Pew Research survey asked 2,373 randomly sampled registered voters their 3.7 Swing voters. political affiliation (Republican, Democrat, or Independent) and whether or not they identify as swing voters. 35% of respondents identified as Independent, 23% identified as swing voters, and 11% identified as both.21 (a) Are being Independent and being a swing voter disjoint, i.e. mutually exclusive? (b) Draw a Venn diagram summarizing the variables and their associated probabilities. (c) What percent of voters are Independent but not swing voters? (d) What percent of voters are Independent or swing voters? (e) What percent of voters are neither Independent nor swing voters? (f) Is the event that someone is a swing voter independent of the event that someone is a political Indepen- dent? 3.8 Poverty and language. The American Community Survey is an ongoing survey that provides data every year to give communities the current information they need to plan investments and services. The 2010 American Community Survey estimates that 14.6% of Americans live below the poverty line, 20.7% speak a language other than English (foreign language) at home, and 4.2% fall into both categories.22 (a) Are living below the poverty line and speaking a foreign language at home disjoint? (b) Draw a Venn diagram summarizing the variables and their associated probabilities. (c) What percent of Americans live below the poverty line and only speak English at home? (d) What percent of Americans live below the poverty line or speak a foreign language at home? (e) What percent of Americans live above the poverty line and only speak English at home? (f) Is
|
the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home? 3.9 Disjoint vs. independent. In parts (a) and (b), identify whether the events are disjoint, independent, or neither (events cannot be both disjoint and independent). (a) You and a randomly selected student from your class both earn A’s in this course. (b) You and your class study partner both earn A’s in this course. (c) If two events can occur at the same time, must they be dependent? In a multiple choice exam, there are 5 questions and 4 choices for each 3.10 Guessing on an exam. question (a, b, c, d). Nancy has not studied for the exam at all and decides to randomly guess the answers. What is the probability that: (a) the first question she gets right is the 5th question? (b) she gets all of the questions right? (c) she gets at least one question right? 21Pew Research Center, With Voters Focused on Economy, Obama Lead Narrows, data collected between April 4-15, 2012. 22U.S. Census Bureau, 2010 American Community Survey 1-Year Estimates, Characteristics of People by Language Spoken at Home. 150 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.11 Educational attainment. The family college data set contains a sample of 792 cases with two variables, teen and parents, and is summarized below.23 The teen variable is either college or not, where the college label means the teen went to college immediately after high school. The parents variable takes the value degree if at least one parent of the teenager completed a college degree. teen college not Total parents degree 231 49 280 not 214 298 512 Total 445 347 792 Table 3.7: Contingency table summarizing the family college data set. (a) For a randomly selected case, what is the probability that a parent completed a college degree? (b) For a randomly selected case, what is the probability that the teen went to college immediately after high school? (c) For a randomly selected case, what is the probability that a parent completed a college degree and teen went to college immediately after high school? (d) Is P(a parent completed college degree and teen went to college immediately after high school) = P(parent completed college degree)
|
x P(teen went to college immediately after high school)? Explain why this is or is not the case. 3.12 School absences. Data collected at elementary schools in DeKalb County, GA suggest that each year roughly 25% of students miss exactly one day of school, 15% miss 2 days, and 28% miss 3 or more days due to sickness.24 (a) What is the probability that a student chosen at random doesn’t miss any days of school due to sickness this year? (b) What is the probability that a student chosen at random misses no more than one day? (c) What is the probability that a student chosen at random misses at least one day? (d) If a parent has two kids at a DeKalb County elementary school, what is the probability that neither kid will miss any school? Note any assumption you must make to answer this question. (e) If a parent has two kids at a DeKalb County elementary school, what is the probability that both kids will miss some school, i.e. at least one day? Note any assumption you make. (f) If you made an assumption in part (d) or (e), do you think it was reasonable? If you didn’t make any assumptions, double check your earlier answers. 23A simulated data set based on real population summaries at nces.ed.gov/pubs2001/2001126.pdf. 24S.S. Mizan et al. “Absence, Extended Absence, and Repeat Tardiness Related to Asthma Status among Elemen- tary School Children”. In: Journal of Asthma 48.3 (2011), pp. 228–234. 3.2. CONDITIONAL PROBABILITY 151 3.2 Conditional probability In this section we will use conditional probabilities to answer the following questions: • What is the likelihood that a machine learning algorithm will misclassify a photo as being about fashion if it is not actually about fashion? • How much more likely are children to attend college whose parents attended college than children whose parents did not attend college? • Given that a person receives a positive test result for a disease, what is the probability that the person actually has the disease? Learning objectives 1. Understand conditional probability and how to calculate it. 2. Calculate joint and conditional probabilities based on a two-way table. 3. Use the General Multiplication Rule to find the probability
|
of joint events. 4. Determine whether two events are independent and whether they are mutually exclusive, based on the definitions of those terms. 5. Draw a tree diagram with at least two branches to organize possible outcomes and their probabilities. Understand that the second branch represents conditional probabilities. 6. Use the tree diagram or Bayes’ Theorem to solve “inverted” conditional probabilities. 152 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.2.1 Exploring probabilities with a contingency table The photo classify data set represents a sample of 1822 photos from a photo sharing website. Data scientists have been working to improve a classifier for whether the photo is about fashion or not, and these 659 photos represent a test for their classifier. Each photo gets two classifications: the first is called mach learn and gives a classification from a machine learning (ML) system of either pred fashion or pred not. Each of these 1822 photos have also been classified carefully by a team of people, which we take to be the source of truth; this variable is called truth and takes values fashion and not. Figure 3.8 summarizes the results. mach learn pred fashion pred not Total truth fashion 197 112 309 not 22 1491 1513 Total 219 1603 1822 Figure 3.8: Contingency table summarizing the photo classify data set. Figure 3.9: A Venn diagram using boxes for the photo classify data set. EXAMPLE 3.25 If a photo is actually about fashion, what is the chance the ML classifier correctly identified the photo as being about fashion? We can estimate this probability using the data. Of the 309 fashion photos, the ML algorithm correctly classified 197 of the photos: P (mach learn is pred fashion given truth is fashion) = 197 309 = 0.638 EXAMPLE 3.26 We sample a photo from the data set and learn the ML algorithm predicted this photo was not about fashion. What is the probability that it was incorrect and the photo is about fashion? If the ML classifier suggests a photo is not about fashion, then it comes from the second row in the data set. Of these 1603 photos, 112 were actually about fashion: P (truth is fashion given mach
|
learn is pred not) = 112 1603 = 0.070 ML Predicts FashionFashion Photos0.110.010.06Neither: 0.82 3.2. CONDITIONAL PROBABILITY 153 3.2.2 Marginal and joint probabilities Figure 3.8 includes row and column totals for each variable separately in the photo classify data set. These totals represent marginal probabilities for the sample, which are the probabilities based on a single variable without regard to any other variables. For instance, a probability based solely on the mach learn variable is a marginal probability: P (mach learn is pred fashion) = 219 1822 = 0.12 A probability of outcomes for two or more variables or processes is called a joint probability: P (mach learn is pred fashion and truth is fashion) = 197 1822 = 0.11 It is common to substitute a comma for “and” in a joint probability, although using either the word “and” or a comma is acceptable: P (mach learn is pred fashion, truth is fashion) means the same thing as P (mach learn is pred fashion and truth is fashion) MARGINAL AND JOINT PROBABILITIES If a probability is based on a single variable, it is a marginal probability. The probability of outcomes for two or more variables or processes is called a joint probability. We use table proportions to summarize joint probabilities for the photo classify sample. These proportions are computed by dividing each count in Figure 3.8 by the table’s total, 1822, to obtain the proportions in Figure 3.10. The joint probability distribution of the mach learn and truth variables is shown in Figure 3.11. mach learn: pred fashion mach learn: pred not Total truth: fashion 0.1081 0.0615 0.1696 truth: not 0.0121 0.8183 0.8304 Total 0.1202 0.8798 1.00 Figure 3.10: Probability table summarizing the photo classify data set. Joint outcome mach learn is pred fashion and truth is fashion mach learn is pred fashion and truth is not mach learn is pred not and truth is fashion mach learn is pred not and truth is not Total Probability 0.1081 0.0121 0.0615 0.8183 1.0000 Figure 3.11: Joint probability distribution for the photo classify data set. GUIDED PRACTICE 3.27 Verify Figure 3.11 represents a probability distribution: events are dis
|
joint, all probabilities are non-negative, and the probabilities sum to 1.25 25Each of the four outcome combination are disjoint, all probabilities are indeed non-negative, and the sum of the probabilities is 0.1081 + 0.0121 + 0.0615 + 0.8183 = 1.00. 154 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS We can compute marginal probabilities using joint probabilities in simple cases. For example, the probability that a randomly selected photo from the data set is about fashion is found by summing the outcomes in which truth takes value fashion: P (truth is fashion) = P (mach learn is pred fashion and truth is fashion) + P (mach learn is pred not and truth is fashion) = 0.1081 + 0.0615 = 0.1696 3.2.3 Defining conditional probability The ML classifier predicts whether a photo is about fashion, even if it is not perfect. We would like to better understand how to use information from a variable like mach learn to improve our probability estimation of a second variable, which in this example is truth. The probability that a random photo from the data set is about fashion is about 0.17. If we knew the machine learning classifier predicted the photo was about fashion, could we get a better estimate of the probability the photo is actually about fashion? Absolutely. To do so, we limit our view to only those 219 cases where the ML classifier predicted that the photo was about fashion and look at the fraction where the photo was actually about fashion: P (truth is fashion given mach learn is pred fashion) = 197 219 = 0.900 We call this a conditional probability because we computed the probability under a condition: the ML classifier prediction said the photo was about fashion. There are two parts to a conditional probability, the outcome of interest and the condition. It is useful to think of the condition as information we know to be true, and this information usually can be described as a known outcome or event. We generally separate the text inside our probability notation into the outcome of interest and the condition with a vertical bar: P (truth is fashion given mach learn is pred fashion) = P (truth is fashion | mach learn is pred fashion) = 197 219 = 0.900 The vertical bar “|” is read as given. In the last equation
|
, we computed the probability a photo was about fashion based on the condition that the ML algorithm predicted it was about fashion as a fraction: P (truth is fashion | mach learn is pred fashion) = = # cases where truth is fashion and mach learn is pred fashion # cases where mach learn is pred fashion 197 219 = 0.900 We considered only those cases that met the condition, mach learn is pred fashion, and then we computed the ratio of those cases that satisfied our outcome of interest, photo was actually about fashion. Frequently, marginal and joint probabilities are provided instead of count data. For example, disease rates are commonly listed in percentages rather than in a count format. We would like to be able to compute conditional probabilities even when no counts are available, and we use the last equation as a template to understand this technique. 3.2. CONDITIONAL PROBABILITY 155 We considered only those cases that satisfied the condition, where the ML algorithm predicted fashion. Of these cases, the conditional probability was the fraction representing the outcome of interest, that the photo was about fashion. Suppose we were provided only the information in Figure 3.10, i.e. only probability data. Then if we took a sample of 1000 photos, we would anticipate about 12.0% or 0.120 × 1000 = 120 would be predicted to be about fashion (mach learn is pred fashion). Similarly, we would expect about 10.8% or 0.108 × 1000 = 108 to meet both the information criteria and represent our outcome of interest. Then the conditional probability can be computed as P (truth is fashion | mach learn is pred fashion) = = # (truth is fashion and mach learn is pred fashion) # (mach learn is pred fashion) 108 120 = 0.108 0.120 = 0.90 Here we are examining exactly the fraction of two probabilities, 0.108 and 0.120, which we can write as P (truth is fashion and mach learn is pred fashion) and P (mach learn is pred fashion). The fraction of these probabilities is an example of the general formula for conditional probability. CONDITIONAL PROBABILITY The conditional probability of the outcome of interest A given condition B is computed as the following: P (A|B) = P (A and B) P (B) GUIDED PRACTICE 3.28 (a) Write out the following statement in conditional probability notation: “The probability that the ML
|
prediction was correct, if the photo was about fashion”. Here the condition is now based on the photo’s truth status, not the ML algorithm. (b) Determine the probability from part (a). Figure 3.10 on page 153 may be helpful.26 GUIDED PRACTICE 3.29 (a) Determine the probability that the algorithm is incorrect if it is known the photo is about fashion. (b) Using the answers from part (a) and Guided Practice 3.28(b), compute P (mach learn is pred fashion | truth is fashion) + P (mach learn is pred not | truth is fashion) (c) Provide an intuitive argument to explain why the sum in (b) is 1.27 26(a) If the photo is about fashion and the ML algorithm prediction was correct, then the ML algorithm my have a value of pred fashion: P (mach learn is pred fashion | truth is fashion) for The equation conditional find (b) P (mach learn is pred fashion and truth is fashion) = 0.1081 and P (truth is not) = 0.1696. Then the ratio represents the conditional probability: 0.1081/0.1696 = 0.6374. 27(a) This probability is P (mach learn is pred not, truth is fashion) 0.1696 = 0.3626. (b) The total equals 1. (c) Under the condition the photo is about fashion, the ML algorithm must have either predicted it was about fashion or predicted it was not about fashion. The complement still works for conditional probabilities, provided the probabilities are conditioned on the same information. P (truth is fashion) probability = 0.0615 indicates should first we 156 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.2.4 Smallpox in Boston, 1721 The smallpox data set provides a sample of 6,224 individuals from the year 1721 who were exposed to smallpox in Boston.28 Doctors at the time believed that inoculation, which involves exposing a person to the disease in a controlled form, could reduce the likelihood of death. Each case represents one person with two variables: inoculated and result. The variable inoculated takes two levels: yes or no, indicating whether the person was inoculated or not. The variable result has outcomes lived or died. These data are summarized in Tables 3.12
|
and 3.13. result lived died Total inoculated yes 238 6 244 5136 844 5980 no Total 5374 850 6224 Figure 3.12: Contingency table for the smallpox data set. result lived died Total inoculated yes 0.0382 0.0010 0.0392 no 0.8252 0.1356 0.9608 Total 0.8634 0.1366 1.0000 Figure 3.13: Table proportions for the smallpox data, computed by dividing each count by the table total, 6224. GUIDED PRACTICE 3.30 Write out, in formal notation, the probability a randomly selected person who was not inoculated died from smallpox, and find this probability.29 GUIDED PRACTICE 3.31 Determine the probability that an inoculated person died from smallpox. How does this result compare with the result of Guided Practice 3.30?30 GUIDED PRACTICE 3.32 The people of Boston self-selected whether or not to be inoculated. (a) Is this study observational or was this an experiment? (b) Can we infer any causal connection using these data? (c) What are some potential confounding variables that might influence whether someone lived or died and also affect whether that person was inoculated?31 28Fenner F. 1988. Smallpox and Its Eradication (History of International Public Health, No. 6). Geneva: World Health Organization. ISBN 92-4-156110-6. 29P (result = died | not inoculated) = P (result = died and not inoculated) 30P (died | inoculated) = P (died and inoculated) P (not inoculated) = 0.0010 0.9608 = 0.1411. 0.0392 = 0.0255. The death rate for individuals who were = 0.1356 P (inoculated) inoculated is only about 1 in 40 while the death rate is about 1 in 7 for those who were not inoculated. 31Brief answers: (a) Observational. (b) No, we cannot infer causation from this observational study. (c) Accessi- bility to the latest and best medical care, so income may play a role. There are other valid answers for part (c). 3.2. CONDITIONAL PROBABILITY 157 3.2.
|
5 General multiplication rule Section 3.1.6 introduced the Multiplication Rule for independent processes. Here we provide the General Multiplication Rule for events that might not be independent. GENERAL MULTIPLICATION RULE If A and B represent two outcomes or events, then P (A and B) = P (A|B) × P (B) For the term P (A|B), it is useful to think of A as the outcome of interest and B as the condition. This General Multiplication Rule is simply a rearrangement of the definition for conditional probability. EXAMPLE 3.33 Consider the smallpox data set. Suppose we are given only two pieces of information: 96.08% of residents were not inoculated, and 85.88% of the residents who were not inoculated ended up surviving. How could we compute the probability that a resident was not inoculated and lived? We will compute our answer using the General Multiplication Rule and then verify it using Figure 3.13. We want to determine and we are given that P (lived and not inoculated) P (lived | not inoculated) = 0.8588 P (not inoculated) = 0.9608 Among the 96.08% of people who were not inoculated, 85.88% survived: P (lived and not inoculated) = 0.8588 × 0.9608 = 0.8251 This is equivalent to the General Multiplication Rule. We can confirm this probability in Figure 3.13 at the intersection of no and lived (with a small rounding error). GUIDED PRACTICE 3.34 Use P (inoculated) = 0.0392 and P (lived | inoculated) = 0.9754 to determine the probability that a person was both inoculated and lived.32 GUIDED PRACTICE 3.35 If 97.54% of the inoculated people lived, what proportion of inoculated people must have died?33 GUIDED PRACTICE 3.36 Based on the probabilities computed above, does it appear that inoculation is effective at reducing the risk of death from smallpox?34 32The answer is 0.0382, which can be verified using Figure 3.13. 33There were only two possible outcomes: lived or died. This means that 100% - 97.54% = 2.46% of the
|
people who were inoculated died. 34The samples are large relative to the difference in death rates for the “inoculated” and “not inoculated” groups, so it seems there is an association between inoculated and outcome. However, as noted in the solution to Guided Practice 3.32, this is an observational study and we cannot be sure if there is a causal connection. (Further research has shown that inoculation is effective at reducing death rates.) 158 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.2.6 Sampling without replacement EXAMPLE 3.37 Professors sometimes select a student at random to answer a question. If each student has an equal chance of being selected and there are 15 people in your class, what is the chance that she will pick you for the next question? If there are 15 people to ask and none are skipping class, then the probability is 1/15, or about 0.067. EXAMPLE 3.38 If the professor asks 3 questions, what is the probability that you will not be selected? Assume that she will not pick the same person twice in a given lecture. For the first question, she will pick someone else with probability 14/15. When she asks the second question, she only has 14 people who have not yet been asked. Thus, if you were not picked on the first question, the probability you are again not picked is 13/14. Similarly, the probability you are again not picked on the third question is 12/13, and the probability of not being picked for any of the three questions is P (not picked in 3 questions) = P (Q1 = not picked, Q2 = not picked, Q3 = not picked.) = 14 15 × 13 14 × 12 13 = 12 15 = 0.80 GUIDED PRACTICE 3.39 What rule permitted us to multiply the probabilities in Example 3.38?35 EXAMPLE 3.40 Suppose the professor randomly picks without regard to who she already selected, i.e. students can be picked more than once. What is the probability that you will not be picked for any of the three questions? Each pick is independent, and the probability of not being picked for any individual question is 14/15. Thus, we can use the Multiplication Rule for independent processes. P (not picked in 3 questions) =
|
P (Q1 = not picked, Q2 = not picked, Q3 = not picked.) = 14 15 × 14 15 × 14 15 = 0.813 You have a slightly higher chance of not being picked compared to when she picked a new person for each question. However, you now may be picked more than once. 35The three probabilities we computed were actually one marginal probability, P (Q1=not picked), and two condi- tional probabilities: P (Q2 = not picked | Q1 = not picked) P (Q3 = not picked | Q1 = not picked, Q2 = not picked) Using the General Multiplication Rule, the product of these three probabilities is the probability of not being picked in 3 questions. 3.2. CONDITIONAL PROBABILITY 159 GUIDED PRACTICE 3.41 Under the setup of Example 3.40, what is the probability of being picked to answer all three questions?36 If we sample from a small population without replacement, we no longer have independence between our observations. In Example 3.38, the probability of not being picked for the second question was conditioned on the event that you were not picked for the first question. In Example 3.40, the professor sampled her students with replacement: she repeatedly sampled the entire class without regard to who she already picked. GUIDED PRACTICE 3.42 Your department is holding a raffle. They sell 30 tickets and offer seven prizes. (a) They place the tickets in a hat and draw one for each prize. The tickets are sampled without replacement, i.e. the selected tickets are not placed back in the hat. What is the probability of winning a prize if you buy one ticket? (b) What if the tickets are sampled with replacement?37 GUIDED PRACTICE 3.43 Compare your answers in Guided Practice 3.42. How much influence does the sampling method have on your chances of winning a prize?38 Had we repeated Guided Practice 3.42 with 300 tickets instead of 30, we would have found something interesting: the results would be nearly identical. The probability would be 0.0233 without replacement and 0.0231 with replacement. SAMPLING WITHOUT REPLACEMENT When the sample size is only a small fraction of the population (under 10%), observations can be considered independent even when sampling without replacement. 36P (being picked to answer
|
all three questions) = 1 15 37(a) First determine the probability of not winning. The tickets are sampled without replacement, which means the probability you do not win on the first draw is 29/30, 28/29 for the second,..., and 23/24 for the seventh. The probability you win no prize is the product of these separate probabilities: 23/30. That is, the probability of winning a prize is 1 − 23/30 = 7/30 = 0.233. (b) When the tickets are sampled with replacement, there are seven independent draws. Again we first find the probability of not winning a prize: (29/30)7 = 0.789. Thus, the probability of winning (at least) one prize when drawing with replacement is 0.211. = 0.00030. 3 38There is about a 10% larger chance of winning a prize when using sampling without replacement. However, at most one prize may be won under this sampling procedure. 160 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.2.7 Independence considerations in conditional probability If two processes are independent, then knowing the outcome of one should provide no informa- tion about the other. We can show this is mathematically true using conditional probabilities. GUIDED PRACTICE 3.44 Let X and Y represent the outcomes of rolling two dice. (a) What is the probability that the first die, X, is 1? (b) What is the probability that both X and Y are 1? (c) Use the formula for conditional probability to compute P (Y = 1 |X = 1). (d) What is P (Y = 1)? Is this different from the answer from part (c)? Explain.39 We can show in Guided Practice 3.44(c) that the conditioning information has no influence by using the Multiplication Rule for independence processes: P (Y = 1|X = 1) = = P (Y = 1 and X = 1) P (X = 1) P (Y = 1) × P (X = 1) P (X = 1) = P (Y = 1) GUIDED PRACTICE 3.45 Ron is watching a roulette table in a casino and notices that the last five outcomes were black. He figures that
|
the chances of getting black six times in a row is very small (about 1/64) and puts his paycheck on red. What is wrong with his reasoning?40 3.2.8 Checking for independent and mutually exclusive events If A and B are independent events, then the probability of A being true is unchanged if B is true. Mathematically, this is written as P (A|B) = P (A) The General Multiplication Rule states that P (A and B) equals P (A|B) × P (B). If A and B are independent events, we can replace P (A|B) with P (A) and the following multiplication rule applies: P (A and B) = P (A) × P (B) CHECKING WHETHER TWO EVENTS ARE INDEPENDENT When checking whether two events A and B are independent, verify one of the following equations holds (there is no need to check both equations): P (A|B) = P (A) P (A and B) = P (A) × P (B) If the equation that is checked holds true (the left and right sides are equal), A and B are independent. If the equation does not hold, then A and B are dependent. 39Brief solutions: (a) 1/6. (b) 1/36. (c) P (Y = 1 and X= 1) 1/6 = 1/6. (d) The probability is the same as in part (c): P (Y = 1) = 1/6. The probability that Y = 1 was unchanged by knowledge about X, which makes sense as X and Y are independent. = 1/36 P (X= 1) 40He has forgotten that the next roulette spin is independent of the previous spins. Casinos do employ this practice; they post the last several outcomes of many betting games to trick unsuspecting gamblers into believing the odds are in their favor. This is called the gambler’s fallacy. 3.2. CONDITIONAL PROBABILITY 161 EXAMPLE 3.46 Are teenager college attendance and parent college degrees independent or dependent? Figure 3.14 may be helpful. We’ll use the first equation above to check for independence. If the teen and parents variables are independent, it must be true that P (teen college | parent degree) = P (teen college) Using Figure 3.14, we check
|
whether equality holds in this equation. P (teen college | parent degree)?= P (teen college) 0.83 = 0.56 The value 0.83 came from a probability calculation using Figure 3.14: 231 280 ≈ 0.83. Because the sides are not equal, teenager college attendance and parent degree are dependent. That is, we estimate the probability a teenager attended college to be higher if we know that one of the teen’s parents has a college degree. teen college not Total parents degree 231 49 280 not 214 298 512 Total 445 347 792 Figure 3.14: Contingency table summarizing the family college data set. GUIDED PRACTICE 3.47 Use the second equation in the box above to show that teenager college attendance and parent college degrees are dependent.41 If A and B are mutually exclusive events, then A and B cannot occur at the same time. Mathematically, this is written as P (A and B) = 0 The General Addition Rule states that P (A or B) equals P (A) + P (B) − P (A and B). If A and B are mutually exclusive events, we can replace P (A and B) with 0 and the following addition rule applies: P (A or B) = P (A) + P (B) 41We check for equality in the following equation: P (teen college, parent degree)? = P (teen college) × P (parent degree) 231 792 = 0.292 = 445 792 × 280 792 = 0.199 These terms are not equal, which confirms what we learned in Example 3.46: teenager college attendance and parent college degrees are dependent. 162 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS CHECKING WHETHER TWO EVENTS ARE MUTUALLY EXCLUSIVE (DISJOINT) If A and B are mutually exclusive events, then they cannot occur at the same time. If asked to determine if events A and B are mutually exclusive, verify one of the following equations holds (there is no need to check both equations): P (A and B) = 0 P (A or B) = P (A) + P (B) If the equation that is checked holds true (the left and right sides are equal), A and B are mutually exclusive. If the equation does not hold, then A and B are not mutually exclusive. EXAMPLE 3.48
|
Are teen college attendance and parent college degrees mutually exclusive? Looking in the table, we see that there are 231 instances where both the teenager attended college and parents have a degree, indicating the probability of both events occurring is greater than 0. Since we have found an example where both of these events happen together, these two events are not mutually exclusive. We could more formally show this by computing the probability both events occur at the same time: P (teen college, parent degree) = 231 792 = 0 Since this probability is not zero, teenager college attendance and parent college degrees are not mutually exclusive. MUTUALLY EXCLUSIVE AND INDEPENDENT ARE DIFFERENT If two events are mutually exclusive, then if one is true, the other cannot be true. This implies the two events are in some way connected, meaning they must be dependent. If two events are independent, then if one occurs, it is still possible for the other to occur, meaning the events are not mutually exclusive. DEPENDENT EVENTS NEED NOT BE MUTUALLY EXCLUSIVE. If two events are dependent, we cannot simply conclude they are mutually exclusive. For example, the college attendance of teenagers and a college degree by one of their parents are dependent, but those events are not mutually exclusive. 3.2. CONDITIONAL PROBABILITY 163 3.2.9 Tree diagrams Tree diagrams are a tool to organize outcomes and probabilities around the structure of the data. They are most useful when two or more processes occur in a sequence and each process is conditioned on its predecessors. The smallpox data fit this description. We see the population as split by inoculation: yes and no. Following this split, survival rates were observed for each group. This structure is reflected in the tree diagram shown in Figure 3.15. The first branch for inoculation is said to be the primary branch while the other branches are secondary. Figure 3.15: A tree diagram of the smallpox data set. Tree diagrams are annotated with marginal and conditional probabilities, as shown in Figure 3.15. This tree diagram splits the smallpox data by inoculation into the yes and no groups with respective marginal probabilities 0.0392 and 0.9608. The secondary branches are conditioned on the first, so we assign conditional probabilities to these branches. For example, the top branch in Figure 3.15 is the probability that lived conditioned on the information that inoculated. We
|
may (and usually do) construct joint probabilities at the end of each branch in our tree by multiplying the numbers we come across as we move from left to right. These joint probabilities are computed using the General Multiplication Rule: P (inoculated and lived) = P (inoculated) × P (lived | inoculated) = 0.0392 × 0.9754 = 0.0382 EXAMPLE 3.49 What is the probability that a randomly selected person who was inoculated died? This is equivalent to P (died | inoculated). This conditional probability can be found in the second branch as 0.0246. InoculatedResultyes, 0.0392lived, 0.97540.0392*0.9754 = 0.03824died, 0.02460.0392*0.0246 = 0.00096no, 0.9608lived, 0.85890.9608*0.8589 = 0.82523died, 0.14110.9608*0.1411 = 0.13557 164 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS EXAMPLE 3.50 What is the probability that a randomly selected person lived? There are two ways that a person could have lived: be inoculated and live OR not be inoculated and live. To find this probability, we sum the two disjoint probabilities: P (lived) = 0.0392 × 0.9745 + 0.9608 × 0.8589 = 0.03824 + 0.82523 = 0.86347 GUIDED PRACTICE 3.51 After an introductory statistics course, 78% of students can successfully construct tree diagrams. Of those who can construct tree diagrams, 97% passed, while only 57% of those students who could not construct tree diagrams passed. (a) Organize this information into a tree diagram. (b) What is the probability that a student who was able to construct tree diagrams did not pass? (c) What is the probability that a randomly selected student was able to successfully construct tree diagrams and passed? (d) What is the probability that a randomly selected student passed? 42 3.2.10 Bayes’ Theorem In many instances, we are given a conditional probability of the form P (statement about variable 1 | statement about variable 2) but we would really like to know the inverted conditional
|
probability: P (statement about variable 2 | statement about variable 1) For example, instead of wanting to know P (lived | inoculated), we might want to know P (inoculated | lived). This is more challenging because it cannot be read directly from the tree diagram. In these instances we use Bayes’ Theorem. Let’s begin by looking at a new example. | able to construct 42(a) The tree diagram is shown to the right. (b) P (not pass tree diagram) = 0.03. (c) P (able to construct tree diagrams and passed) = P (able to construct tree diagrams) × P (passed | able to construct tree diagrams) = 0.78 × 0.97 = 0.7566. (d) P (passed) = 0.7566 + 0.1254 = 0.8820. Able to constructtree diagramsPass classyes, 0.78pass, 0.970.78*0.97 = 0.7566fail, 0.030.78*0.03 = 0.0234no, 0.22pass, 0.570.22*0.57 = 0.1254fail, 0.430.22*0.43 = 0.0946 3.2. CONDITIONAL PROBABILITY 165 EXAMPLE 3.52 In Canada, about 0.35% of women over 40 will develop breast cancer in any given year. A common screening test for cancer is the mammogram, but this test is not perfect. In about 11% of patients with breast cancer, the test gives a false negative: it indicates a woman does not have breast cancer when she does have breast cancer. Similarly, the test gives a false positive in 7% of patients who do not have breast cancer: it indicates these patients have breast cancer when they actually do not. If we tested a random woman over 40 for breast cancer using a mammogram and the test came back positive – that is, the test suggested the patient has cancer – what is the probability that the patient actually has breast cancer? We are given sufficient information to quickly compute the probability of testing positive if a woman has breast cancer (1.00 − 0.11 = 0.89). However, we seek the inverted probability of cancer given a positive test result: P (has BC | mammogram+) Here, “has BC” is an abbreviation for the patient actually having
|
breast cancer, and “mammogram+” means the mammogram screening was positive, which in this case means the test suggests the patient has breast cancer. (Watch out for the non-intuitive medical language: a positive test result suggests the possible presence of cancer in a mammogram screening.) We can use the conditional probability formula from the previous section: P (A|B) = P (A and B). Our conditional probability can be found as follows: P (B) P (has BC | mammogram+) = P (has BC and mammogram+) P (mammogram+) The probability that a mammogram is positive is as follows. P (mammogram+) = P (has BC and mammogram+) + P (no BC and mammogram+) A tree diagram is useful for identifying each probability and is shown in Figure 3.16. Using the tree diagram, we find that P (has BC | mammogram+) = = = P (has BC and mammogram+) P (has BC and mammogram+) + P (no BC and mammogram+) 0.0035(0.89) 0.0035(0.89) + 0.9965(0.07) 0.00312 0.07288 ≈ 0.0428 That is, even if a patient has a positive mammogram screening, there is still only a 4% chance that she has breast cancer. Example 3.52 highlights why doctors often run more tests regardless of a first positive test result. When a medical condition is rare, a single positive test isn’t generally definitive. 166 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Figure 3.16: Tree diagram for Example 3.52, computing the probability a random patient who tests positive on a mammogram actually has breast cancer. Consider again the last equation of Example 3.52. Using the tree diagram, we can see that the numerator (the top of the fraction) is equal to the following product: P (has BC and mammogram+) = P (mammogram+| has BC)P (has BC) The denominator – the probability the screening was positive – is equal to the sum of probabilities for each positive screening scenario: P (mammogram+) = P (mammogram+ and no BC) + P (mammogram+ and has BC) In the example, each of the probabilities on the right
|
side was broken down into a product of a conditional probability and marginal probability using the tree diagram. P (mammogram+) = P (mammogram+ and no BC) + P (mammogram+ and has BC) = P (mammogram+| no BC)P (no BC) + P (mammogram+| has BC)P (has BC) We can see an application of Bayes’ Theorem by substituting the resulting probability expressions into the numerator and denominator of the original conditional probability. P (has BC| mammogram+) = P (mammogram+| has BC)P (has BC) P (mammogram+| no BC)P (no BC) + P (mammogram+| has BC)P (has BC) TruthMammogramcancer, 0.0035positive, 0.890.0035*0.89 = 0.00312negative, 0.110.0035*0.11 = 0.00038no cancer, 0.9965positive, 0.070.9965*0.07 = 0.06976negative, 0.930.9965*0.93 = 0.92675 3.2. CONDITIONAL PROBABILITY 167 BAYES’ THEOREM: INVERTING PROBABILITIES Consider the following conditional probability for variable 1 and variable 2: P (outcome A1 of variable 1| outcome B of variable 2) Bayes’ Theorem states that this conditional probability can be identified as the following fraction: P (B|A1)P (A1) P (B|A1)P (A1) + P (B|A2)P (A2) + · · · + P (B|Ak)P (Ak) where A2, A3,..., and Ak represent all other possible outcomes of the first variable. Bayes’ Theorem is just a generalization of what we have done using tree diagrams. The formula need not be memorized, since it can always be derived using a tree diagram: • The numerator identifies the probability of getting both A1 and B. • The denominator is the overall probability of getting B. Traverse each branch of the tree diagram that ends with event B. Add up the required products. GUIDED PRACTICE 3.53 Jose
|
visits campus every Thursday evening. However, some days the parking garage is full, often due to college events. There are academic events on 35% of evenings, sporting events on 20% of evenings, and no events on 45% of evenings. When there is an academic event, the garage fills up about 25% of the time, and it fills up 70% of evenings with sporting events. On evenings when there are no events, it only fills up about 5% of the time. If Jose comes to campus and finds the garage full, what is the probability that there is a sporting event? Use a tree diagram to solve this problem. The tree diagram, with three primary branches, shown to the right. We want is P (sporting event|garage full) = = P (sporting event and garage full) P (garage full) 0.14 0.0875 + 0.14 + 0.0225 = 0.56. If the garage is full, there is a 56% probability that there is a sporting event. The last several exercises offered a way to update our belief about whether there is a sporting event, academic event, or no event going on at the school based on the information that the parking lot was full. This strategy of updating beliefs using Bayes’ Theorem is actually the foundation of an entire section of statistics called Bayesian statistics. While Bayesian statistics is very important and useful, we will not have time to cover it in this book. EventGarage fullAcademic, 0.35Full, 0.250.35*0.25 = 0.0875Spaces Available, 0.750.35*0.75 = 0.2625Sporting, 0.20Full, 0.70.2*0.7 = 0.14Spaces Available, 0.30.2*0.3 = 0.06None, 0.45Full, 0.050.45*0.05 = 0.0225Spaces Available, 0.950.45*0.95 = 0.4275 168 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Section summary • A conditional probability can be written as P (A|B) and is read, “Probability of A given B”. P (A|B) is the probability of A, given that B has occurred. In
|
a conditional probability, we are given some information. In an unconditional probability, such as P (A), we are not given any information. • Sometimes P (A|B) can be deduced. For example, when drawing without replacement from a deck of cards, P (2nd draw is an Ace | 1st draw was an Ace) = 3 51. When this is not the case, as when working with a table or a Venn diagram, one must use the conditional probability rule P (A|B) = P (A and B). P (B) • In the last section, we saw that two events are independent when the outcome of one has no effect on the outcome of the other. When A and B are independent, P (A|B) = P (A). • When A and B are dependent, find the probability of A and B using the General Multi- plication Rule: P (A and B) = P (A|B) × P (B). • In the special case where A and B are independent, P (A and B) = P (A) × P (B). • If A and B are mutually exclusive, they must be dependent, since the occurrence of one of them changes the probability that the other occurs to 0. • When sampling without replacement, such as drawing cards from a deck, make sure to use conditional probabilities when solving and problems. • Sometimes, the conditional probability P (B|A) may be known, but we are interested in the “inverted” probability P (A|B). Bayes’ Theorem helps us solve such conditional probabilities that cannot be easily answered. However, rather than memorize Bayes’ Theorem, one can generally draw a tree diagram and apply the conditional probability rule P (A|B) = P (A and B). P (B) 3.2. CONDITIONAL PROBABILITY 169 Exercises 3.13 Joint and conditional probabilities. P(A) = 0.3, P(B) = 0.7 (a) Can you compute P(A and B) if you only know P(A) and P(B)? (b) Assuming that events A and B arise from independent random processes, i. what is P(A and B)? ii. what is P(A or B)? iii. what is P(A|B)? (c) If we are given
|
that P(A and B) = 0.1, are the random variables giving rise to events A and B indepen- dent? (d) If we are given that P(A and B) = 0.1, what is P(A|B)? 3.14 PB & J. Suppose 80% of people like peanut butter, 89% like jelly, and 78% like both. Given that a randomly sampled person likes peanut butter, what’s the probability that he also likes jelly? A Pew Research poll asked 1,306 Americans “From what you’ve read and 3.15 Global warming. heard, is there solid evidence that the average temperature on earth has been getting warmer over the past few decades, or not?”. The table below shows the distribution of responses by party and ideology, where the counts have been replaced with relative frequencies.43 Response Not Earth is warming warming Conservative Republican Party and Mod/Lib Republican Mod/Cons Democrat Ideology Liberal Democrat Total 0.11 0.06 0.25 0.18 0.60 0.20 0.06 0.07 0.01 0.34 Don’t Know Refuse 0.02 0.01 0.02 0.01 0.06 Total 0.33 0.13 0.34 0.20 1.00 (a) Are believing that the earth is warming and being a liberal Democrat mutually exclusive? (b) What is the probability that a randomly chosen respondent believes the earth is warming or is a liberal Democrat? (c) What is the probability that a randomly chosen respondent believes the earth is warming given that he is a liberal Democrat? (d) What is the probability that a randomly chosen respondent believes the earth is warming given that he is a conservative Republican? (e) Does it appear that whether or not a respondent believes the earth is warming is independent of their party and ideology? Explain your reasoning. (f) What is the probability that a randomly chosen respondent is a moderate/liberal Republican given that he does not believe that the earth is warming? 43Pew Research Center, Majority of Republicans No Longer See Evidence of Global Warming, data collected on October 27, 2010. 170 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.16 Health coverage, relative frequencies. The Behavioral Risk Factor Surveillance System (BRFSS) is an annual telephone survey designed to identify risk factors in the adult population and report emerging health trends. The following table displays the
|
distribution of health status of respondents to this survey (excellent, very good, good, fair, poor) and whether or not they have health insurance. Health Coverage No Yes Total Excellent Very good 0.0364 0.3123 0.3486 0.0230 0.2099 0.2329 Health Status Good 0.0427 0.2410 0.2838 Fair 0.0192 0.0817 0.1009 Poor 0.0050 0.0289 0.0338 Total 0.1262 0.8738 1.0000 (a) Are being in excellent health and having health coverage mutually exclusive? (b) What is the probability that a randomly chosen individual has excellent health? (c) What is the probability that a randomly chosen individual has excellent health given that he has health coverage? (d) What is the probability that a randomly chosen individual has excellent health given that he doesn’t have health coverage? (e) Do having excellent health and having health coverage appear to be independent? 3.17 Marbles in an urn. Imagine you have an urn containing 5 red, 3 blue, and 2 orange marbles in it. (a) What is the probability that the first marble you draw is blue? (b) Suppose you drew a blue marble in the first draw. If drawing with replacement, what is the probability of drawing a blue marble in the second draw? (c) Suppose you instead drew an orange marble in the first draw. If drawing with replacement, what is the probability of drawing a blue marble in the second draw? (d) If drawing with replacement, what is the probability of drawing two blue marbles in a row? (e) When drawing with replacement, are the draws independent? Explain. 3.18 Socks in a drawer. In your sock drawer you have 4 blue, 5 gray, and 3 black socks. Half asleep one morning you grab 2 socks at random and put them on. Find the probability you end up wearing (a) 2 blue socks (b) no gray socks (c) at least 1 black sock (d) a green sock (e) matching socks 3.19 Chips in a bag. Imagine you have a bag containing 5 red, 3 blue, and 2 orange chips. (a) Suppose you draw a chip and it is blue. If drawing without replacement, what is the probability the next is also blue? (b) Suppose you
|
draw a chip and it is orange, and then you draw a second chip without replacement. What is the probability this second chip is blue? (c) If drawing without replacement, what is the probability of drawing two blue chips in a row? (d) When drawing without replacement, are the draws independent? Explain. 3.2. CONDITIONAL PROBABILITY 171 3.20 Books on a bookshelf. The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback. Format Hardcover Paperback Total Type Fiction Nonfiction Total 13 15 28 59 8 67 72 23 95 (a) Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement. (b) Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement. (c) Calculate the probability of the scenario in part (b), except this time complete the calculations under the scenario where the first book is placed back on the bookcase before randomly drawing the second book. (d) The final answers to parts (b) and (c) are very similar. Explain why this is the case. In a classroom with 24 students, 7 students are wearing jeans, 4 are wearing 3.21 Student outfits. shorts, 8 are wearing skirts, and the rest are wearing leggings. If we randomly select 3 students without replacement, what is the probability that one of the selected students is wearing leggings and the other two are wearing jeans? Note that these are mutually exclusive clothing options. 3.22 The birthday problem. Suppose we pick three people at random. For each of the following questions, ignore the special case where someone might be born on February 29th, and assume that births are evenly distributed throughout the year. (a) What is the probability that the first two people share a birthday? (b) What is the probability that at least two people share a birthday? 3.23 Drawing box plots. After an introductory statistics course, 80% of students can successfully construct box plots. Of those who can construct box plots, 86% passed, while only 65% of those students who could not construct box plots passed. (a) Construct a tree diagram of this scenario. (b
|
) Calculate the probability that a student is able to construct a box plot if it is known that he passed. 3.24 Predisposition for thrombosis. A genetic test is used to determine if people have a predisposition for thrombosis, which is the formation of a blood clot inside a blood vessel that obstructs the flow of blood It is believed that 3% of people actually have this predisposition. The through the circulatory system. genetic test is 99% accurate if a person actually has the predisposition, meaning that the probability of a positive test result when a person actually has the predisposition is 0.99. The test is 98% accurate if a person does not have the predisposition. What is the probability that a randomly selected person who tests positive for the predisposition by the test actually has the predisposition? Lupus is a medical phenomenon where antibodies that are supposed to attack 3.25 It’s never lupus. foreign cells to prevent infections instead see plasma proteins as foreign bodies, leading to a high risk of blood clotting. It is believed that 2% of the population suffer from this disease. The test is 98% accurate if a person actually has the disease. The test is 74% accurate if a person does not have the disease. There is a line from the Fox television show House that is often used after a patient tests positive for lupus: “It’s never lupus.” Do you think there is truth to this statement? Use appropriate probabilities to support your answer. 3.26 Exit poll. Edison Research gathered exit poll results from several sources for the Wisconsin recall election of Scott Walker. They found that 53% of the respondents voted in favor of Scott Walker. Additionally, they estimated that of those who did vote in favor for Scott Walker, 37% had a college degree, while 44% of those who voted against Scott Walker had a college degree. Suppose we randomly sampled a person who participated in the exit poll and found that he had a college degree. What is the probability that he voted in favor of Scott Walker?44 44New York Times, Wisconsin recall exit polls. 172 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS 3.3 Simulations What is the probability of getting a sum greater than 16 in three rolls of a die? Finding all possible combinations that satisfy this would be tedious, but we could conduct a physical simulation or a computer simulation to estimate this
|
probability. With modern computing power, simulations have become an important and powerful tool for data scientists. In this section, we will look at the concepts that underlie simulations. Learning objectives 1. Understand the purpose of a simulation and recognize the application of the long-run relative frequency interpretation of probability. 2. Understand how random digit tables work and how to assign digits to outcomes. 3. Be able to repeat a simulation a set number of trials or until a condition is true, and use the results to estimate the probability of interest. 3.3.1 Setting up and carrying out simulations In the previous section we saw how to apply the binomial formula to find the probability of exactly x successes in n independent trials when a success has probability p. Sometimes we have a problem we want to solve but we don’t know the appropriate formula, or even worse, a formula may not exist. In this case, one common approach is to estimate the probability using simulations. You may already be familiar with simulations. Want to know the probability of rolling a sum of 7 with a pair of dice? Roll a pair of dice many, many, many times and see what proportion of times the sum is 7. The more times you roll the pair of dice, the better the estimate will tend to be. Of course, such experiments can be time consuming or even infeasible. In this section, we consider simulations using random numbers. Random numbers (or technically, psuedo-random numbers) can be produced using a calculator or computer. Random digits are produced such that each digit, 0-9, is equally likely to come up in each spot. You’ll find that occasionally we may have the same number in a row – sometimes multiple times – but in the long run, each digit should appear 1/10th of the time. Row 1 2 3 4 5 6 7 8 9 10 Column 1-5 43087 63432 19025 85117 16285 94342 61099 37537 04510 27217 6-10 41864 72132 83056 16706 56280 18473 14136 58839 16172 12151 11-15 51009 40269 62511 31083 01494 50845 39052 56876 90838 52645 16-20 39689 56103 52598 24816 90240 77757 50235 02960 15210 96218 Figure 3.17: Random number table. A full page of random numbers may be found in
|
Appendix C.1 on page 509. 3.3. SIMULATIONS 173 EXAMPLE 3.54 Mika’s favorite brand of cereal is running a special where 20% of the cereal boxes contain a prize. Mika really wants that prize. If her mother buys 6 boxes of the cereal over the next few months, what is the probability Mika will get a prize? To solve this problem using simulation, we need to be able to assign digits to outcomes. Each box should have a 20% chance of having a prize and an 80% chance of not having a prize. Therefore, a valid assignment would be: 0, 1 → prize 2-9 → no prize Of the ten possible digits (0, 1, 2,..., 8, 9 ), two of them, i.e. 20% of them, correspond to winning a prize, which exactly matches the odds that a cereal box contains a prize. In Mika’s simulation, one trial will consist of 6 boxes of cereal, and therefore a trial will require six digits (each digit will correspond to one box of cereal). We will repeat the simulation for 20 trials. Therefore we will need 20 sets of 6 digits. Let’s begin on row 1 of the random digit table, shown in Figure 3.17. If a trial consisted of 5 digits, we could use the first 5 digits going across: 43087. Because here a trial consists of 6 digits, it may be easier to read down the table, rather than read across. We will let trial 1 consist of the first 6 digits in column 1 (461819 ), trial 2 consist of the first 6 digits in column 2 (339564 ), etc. For this simulation, we will end up using the first 6 rows of each of the 20 columns. In trial 1, there are two 1 ’s, so we record that as a success; in this trial there were actually two prizes. In trial 2 there were no 0 ’s or 1 ’s, therefore we do not record this as a success. In trial 3 there were three prizes, so we record this as a success. The rest of this exercise is left as a Guided Practice problem for you to complete. GUIDED PRACTICE 3.55 Finish the simulation above and report the estimate for the probability that Mika will get a prize if her mother buys 6 boxes of cereal where each
|
one has a 20% chance of containing a prize.45 GUIDED PRACTICE 3.56 In the previous example, the probability that a box of cereal contains a prize is 20%. The question presented is equivalent to asking, what is the probability of getting at least one prize in six randomly selected boxes of cereal. This probability question can be solved explicitly using the method of complements. Find this probability. How does the estimate arrived at by simulation compare to this probability?46 45The trials that contain at least one 0 or 1 and therefore are successes are trials: 1, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, and 20. There were 17 successes among the 20 trials, so our estimate of the probability based on this simulation is 17/20 = 0.85. 46The true probability is given by 1 − P (no prizes in six boxes) = 1 − 0.86 = 0.74. The estimate arrived at by simulation was 11% too high. Note: We only repeated the simulation 20 times. If we had repeated it 1000 times, we would (very likely) have gotten an estimate closer to the true probability. 174 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS We can also use simulations to estimate quantities other than probabilities. Consider the following example. EXAMPLE 3.57 Let’s say that instead of buying exactly 6 boxes of cereal, Mika’s mother agrees to buy boxes of this cereal until she finds one with a prize. On average, how many boxes of cereal would one have to buy until one gets a prize? For this question, we can use the same digit assignment. However, our stopping rule is different. Each trial may require a different number of digits. For each trial, the stopping rule is: look at digits until we encounter a 0 or a 1. Then, record how many digits/boxes of cereal it took. Repeat the simulation for 20 trials, and then average the numbers from each trial. Let’s begin again at row 1. We can read across or down, depending upon what is most convenient. Since there are 20 columns and we want 20 trials, we will read down the columns. Starting at column 1, we count how many digits (boxes of cereal) we encounter until we reach a 0 or 1 (which represent a prize). For
|
trial 1 we see 461, so we record 3. For trial 2 we see 3395641, so we record 7. For trial 3, we see 0, so we record 1. The rest of this exercise is left as a Guided Practice problem for you to complete. GUIDED PRACTICE 3.58 Finish the simulation above and report your estimate for the average number of boxes of cereal one would have to buy until encountering a prize, where the probability of a prize in each box is 20%.47 EXAMPLE 3.59 Now, consider a case where the probability of interest is not 20%, but rather 28%. Which digits should correspond to success and which to failure? This example is more complicated because with only 10 digits, there is no way to select exactly 28% of them. Therefore, each observation will have to consist of two digits. We can use two digits at a time and assign pairs of digits as follows: 00-27 → success 28-99 → failure GUIDED PRACTICE 3.60 Assume the probability of winning a particular casino game is 45%. We want to carry out a simulation to estimate the probability that we will win at least 5 times in 10 plays. We will use 30 trials of the simulation. Assign digits to outcomes. Also, how many total digits will we require to run this simulation?48 47For the 20 trials, the number of digits we see until we encounter a 0 or 1 is: 3,7,1,4,9, 4,1,2,4,5, 5,1,1,1,3, 8,5,2,2,6. Now we take the average of these 20 numbers to get 74/20 = 3.7. 48One possible assignment is: 00-44 → win and 45-99 → lose. Each trial requires 10 pairs of digits, so we will need 30 sets of 10 pairs of digits for a total of 30 × 10 × 2 = 600 digits. 3.3. SIMULATIONS 175 GUIDED PRACTICE 3.61 Assume carnival spinner has 7 slots. We want to carry out a simulation to estimate the probability that we will win at least 10 times in 60 plays. Repeat 100 trials of the simulation. Assign digits to outcomes. Also, how many total digits will we require to run this simulation?49 Does anyone perform simulations like this? Sort of. Simulations are used a lot in statistics, and these often require the same principles covered
|
in this section to properly set up those simulations. The difference is in implementation after the setup. Rather than use a random number table, a data scientist will write a program that uses a pseudo-random number generator in a computer to run the simulations very quickly – often times millions of trials each second, which provides much more accurate estimates than running a couple dozen trials by hand. Section summary • When a probability is difficult to determine via a formula, one can set up a simulation to estimate the probability. • The relative frequency theory of probability and the Law of Large Numbers are the mathematical underpinning of simulations. A larger number of trials should tend to produce better estimates. • The first step to setting up a simulation is to assign digits to represent outcomes. This should be done in such a way as to give the event of interest the correct probability. Then, using a random number table, calculator, or computer, generate random digits (outcomes). Repeat this a specified number of trials or until a given stopping rule. When this is finished, count up how many times the event happened and divide that by the number of trials to get the estimate of the probability. 49Note that 1/7 = 0.142857... This makes it tricky to assign digits to outcomes. The best approach here would be to exclude some of the digits from the simulation. We can assign 0 to success and 1-6 to failure. This corresponds to a 1/7 chance of getting a success. If we encounter a 7, 8, or 9, we will just skip over it. Because we don’t know how many 7, 8, or 9 ’s we will encounter, we do not know how many total digits we will end up using for the simulation. (If you want a challenge, try to estimate the total number of digits you would need.) 176 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Exercises 3.27 Smog check, Part I. Suppose 16% of cars fail pollution tests (smog checks) in California. We would like to estimate the probability that an entire fleet of seven cars would pass using a simulation. We assume each car is independent. We only want to know if the entire fleet passed, i.e. none of the cars failed. What is wrong with each of the following simulations to represent whether an entire (sim
|
ulated) fleet passed? (a) Flip a coin seven times where each toss represents a car. A head means the car passed and a tail means it failed. If all cars passed, we report PASS for the fleet. If at least one car failed, we report FAIL. (b) Read across a random number table starting at line 5. If a number is a 0 or 1, let it represent a failed car. Otherwise the car passes. We report PASS if all cars passed and FAIL otherwise. (c) Read across a random number table, looking at two digits for each simulated car. If a pair is in the range [00-16], then the corresponding car failed. If it is in [17-99], the car passed. We report PASS if all cars passed and FAIL otherwise. 3.28 Left-handed. Studies suggest that approximately 10% of the world population is left-handed. Use ten simulations to answer each of the following questions. For each question, describe your simulation scheme clearly. (a) What is the probability that at least one out of eight people are left-handed? (b) On average, how many people would you have to sample until the first person who is left-handed? (c) On average, how many left-handed people would you expect to find among a random sample of six people? 3.29 Smog check, Part II. Consider the fleet of seven cars in Exercise 3.27. Remember that 16% of cars fail pollution tests (smog checks) in California, and that we assume each car is independent. (a) Write out how to calculate the probability of the fleet failing, i.e. at least one of the cars in the fleet failing, via simulation. (b) Simulate 5 fleets. Based on these simulations, estimate the probability at least one car will fail in a fleet. (c) Compute the probability at least one car fails in a fleet of seven. 3.30 To catch a thief. Suppose that at a retail store, 1/5th of all employees steal some amount of merchandise. The stores would like to put an end to this practice, and one idea is to use lie detector tests to catch and fire thieves. However, there is a problem: lie detectors are
|
not 100% accurate. Suppose it is known that a lie detector has a failure rate of 25%. A thief will slip by the test 25% of the time and an honest employee will only pass 75% of the time. (a) Describe how you would simulate whether an employee is honest or is a thief using a random number table. Write your simulation very carefully so someone else can read it and follow the directions exactly. (b) Using a random number table, simulate 20 employees working at this store and determine if they are honest or not. Make sure to record the random digits assigned to each employee as you will refer back to these in part (c). (c) Determine the result of the lie detector test for each simulated employee from part (b) using a new simulation scheme. (d) How many of these employees are “honest and passed” and how many are “honest and failed”? (e) How many of these employees are “thief and passed” and how many are “thief and failed”? (f) Suppose the management decided to fire everyone who failed the lie detector test. What percent of fired employees were honest? What percent of not fired employees were thieves? 3.4. RANDOM VARIABLES 177 3.4 Random variables The chance of landing on single number in the game of roulette is 1/38 and the pay is 35:1. The chance of landing on Red is 18/38 and the pay is 1:1. Which game has the higher expected value? The higher standard deviation of expected winnings? How do we interpret these quantities in this context? If you were to play each game 20 times, what would the distribution of possible outcomes look like? In this section, we define and summarize random variables such as this, and we look at some of their properties. Learning objectives 1. Define a probability distribution and what makes a distribution a valid probability distribution. 2. Summarize a discrete probability distribution graphically using a histogram and verbally with respect to center, spread, and shape. 3. Calculate and interpret the mean (expected value) and standard deviation of a random variable. 4. Calculate the mean and standard deviation of a transformed random variable. 5. Calculate the mean of the sum or difference of random variables. 6. Calculate the standard deviation of the sum
|
or difference of random variables when those variables are independent. 3.4.1 Introduction to expected value EXAMPLE 3.62 Two books are assigned for a statistics class: a textbook and its corresponding study guide. The university bookstore determined 20% of enrolled students do not buy either book, 55% buy the textbook only, and 25% buy both books, and these percentages are relatively constant from one term to another. If there are 100 students enrolled, how many books should the bookstore expect to sell to this class? Around 20 students will not buy either book (0 books total), about 55 will buy one book (55 books total), and approximately 25 will buy two books (totaling 50 books for these 25 students). The bookstore should expect to sell about 105 books for this class. GUIDED PRACTICE 3.63 Would you be surprised if the bookstore sold slightly more or less than 105 books?50 50If they sell a little more or a little less, this should not be a surprise. Hopefully Chapter 2 helped make clear that there is natural variability in observed data. For example, if we would flip a coin 100 times, it will not usually come up heads exactly half the time, but it will probably be close. 178 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS EXAMPLE 3.64 The textbook costs $137 and the study guide $33. How much revenue should the bookstore expect from this class of 100 students? About 55 students will just buy a textbook, providing revenue of $137 × 55 = $7, 535 The roughly 25 students who buy both the textbook and the study guide would pay a total of ($137 + $33) × 25 = $170 × 25 = $4, 250 Thus, the bookstore should expect to generate about $7, 535 + $4, 250 = $11, 785 from these 100 students for this one class. However, there might be some sampling variability so the actual amount may differ by a little bit. Figure 3.18: Probability distribution for the bookstore’s revenue from one student. The triangle represents the average revenue per student. EXAMPLE 3.65 What is the average revenue per student for this course? The expected total revenue is $11,785, and there are 100 students. Therefore the expected revenue per student is $11, 785/100 = $117.85. 3.4.2 Probability distributions A probability
|
distribution is a table of all disjoint outcomes and their associated probabili- ties. Figure 3.19 shows the probability distribution for the sum of two dice. RULES FOR PROBABILITY DISTRIBUTIONS A probability distribution is a list of the possible outcomes with corresponding probabilities that satisfies three rules: 1. The outcomes listed must be disjoint. 2. Each probability must be between 0 and 1. 3. The probabilities must total 1. cost (dollars)01371700.00.10.20.30.40.5probability 3.4. RANDOM VARIABLES 179 GUIDED PRACTICE 3.66 Figure 3.20 suggests three distributions for household income in the United States. Only one is correct. Which one must it be? What is wrong with the other two?51 Dice sum Probability 2 1 36 3 2 36 4 3 36 5 4 36 6 5 36 7 6 36 8 5 36 9 4 36 10 3 36 11 2 36 12 1 36 Figure 3.19: Probability distribution for the sum of two dice. Income range ($1000s) (a) (b) (c) 0-25 0.18 0.38 0.28 25-50 0.39 -0.27 0.27 50-100 0.33 0.52 0.29 100+ 0.16 0.37 0.16 Figure 3.20: Proposed distributions of US household incomes (Guided Practice 3.66). Chapter 2 emphasized the importance of plotting data to provide quick summaries. Probability distributions can also be summarized in a histogram or bar plot. The probability distribution for the sum of two dice is shown in Figure 3.19 and its histogram is plotted in Figure 3.21. The distribution of US household incomes is shown in Figure 3.22 as a bar plot. The presence of the 100+ category makes it difficult to represent it with a regular histogram. Figure 3.21: A histogram for the probability distribution of the sum of two dice. In these bar plots, the bar heights represent the probabilities of outcomes. If the outcomes are numerical and discrete, it is usually (visually) convenient to make a histogram, as in the case of the sum of two dice. Another example of plotting the bars at their respective locations is shown in Figure 3.18. 51The probabilities of (a) do not sum to 1. The second
|
probability in (b) is negative. This leaves (c), which sure enough satisfies the requirements of a distribution. One of the three was said to be the actual distribution of US household incomes, so it must be (c). Dice sum234567891011120.000.050.100.15Probability 180 CHAPTER 3. PROBABILITY AND PROBABILITY DISTRIBUTIONS Figure 3.22: A bar graph for the probability distribution of US household income. Because it is artificially separated into four unequal bins, this graph fails to show the shape or skew of the distribution. 3.4.3 Expectation We call a variable or process with a numerical outcome a random variable, and we usually represent this random variable with a capital letter such as X, Y, or Z. The amount of money a single student will spend on her statistics books is a random variable, and we represent it by X. RANDOM VARIABLE A random process or variable with a numerical outcome. The possible outcomes of X are labeled with a corresponding lower case letter x and subscripts. For example, we write x1 = $0, x2 = $137, and x3 = $170, which occur with probabilities 0.20, 0.55, and 0.25. The distribution of X is summarized in Figure 3.18 and Figure 3.23. i xi P (xi) 1 $0 0.20 2 $137 0.55 3 $170 0.25 Total – 1.00 Figure 3.23: The probability distribution for the random variable X, representing the bookstore’s revenue from a single student. We use P (xi) to represent the probability of xi. We computed the average outcome of X as $117.85 in Example 3.65. We call this average the expected value of X, denoted by E(X). The expected value of a random variable is computed by adding each outcome weighted by its probability: E(X) = 0 · P (0) + 137 · P (137) + 170 · P (170) = 0 · 0.20 + 137 · 0.55 + 170 · 0.25 = 117.85 EXPECTED VALUE OF A DISCRETE RANDOM VARIABLE If X takes outcomes x1, x2,..., xn with probabilities P (x1), P (x2),..., P (xn), the mean
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.