STAT 145 (Notes) Al Nosedal anosedal@unm.edu Department of Mathematics and Statistics University of New Mexico Fall 2013 . . . . . . CHAPTER 4 SCATTERPLOTS AND CORRELATION. . . . . . . Definitions I A response variable measures an outcome of a study. . . . . . . Definitions I A response variable measures an outcome of a study. I An explanatory variable may explain or influence changes in a response variable. . . . . . . Coral reefs How sensitive to changes in water temperature are coral reefs? To find out, scientists examined data on sea surface temperatures and coral growth per year at locations in the Red Sea. What are the explanatory and response variables? Are they categorical or quantitative? . . . . . . Solution Sea-surface temperature is the explanatory variable; coral growth is the response variable. Both are quantitative. . . . . . . Scatterplot A scatterplot shows the relationship between two quantitative variables measured on the same individuals. The values of one variable appear on the horizontal axis, and the values of the other variable appear on the vertical axis. Each individual in the data appears as the point in the plot fixed by the values of both variables for that individual. Always plot the explanatory variable, if there is one, on the horizontal axis (the x axis) of a scatterplot. As a reminder, we usually call the explanatory variable x and the response variable y . If there is no explanatory-response distinction, either variable can go on the horizontal axis. . . . . . . Do heavier people burn more energy? Metabolic rate, the rate at which the body consumes energy, is important in studies of weight gain, dieting, and exercise. We have data on the lean body mass and resting metabolic rate for 12 women who are subjects in a study of dieting. Lean body mass, given in kilograms, is a person’s weight leaving out all fat. Metabolic rate is measured in calories burned per 24 hours. . . . . . . Data Mass 36.1 54.6 48.5 42.0 50.6 42.0 Rate 995 1425 1396 1418 1502 1256 Mass 40.3 33.1 42.4 34.5 51.1 41.2 Rate 1189 913 1124 1052 1347 1204 The researchers believe that lean body mass is an important influence on metabolic rate. Make a scatterplot to examine this belief. . . . . . . 900 1000 1100 1200 1300 Metabolic Rate (calories/day) 1400 1500 Scatterplot 35 40 Lean Body Mass (kg) 45 50 . . 55 . . . . Examining a Scatterplot In any graph of data, look for the overall pattern and for striking deviations from the pattern. You can describe the overall pattern of a scatterplot by the direction, form, and strength of the relationship. An important kind of deviation is an outlier, an individual value that falls outside the overall pattern of the relationship. . . . . . . Positive Association, Negative Association Two variables are positively associated when above-average values of one tend to accompany above-average values of the other, and below-average values also tend to occur together. Two variables are negatively associated when above-average values of one tend to accompany below-average values of the other, and vice versa. The strength of a relationship in a scatterplot is determined by how closely the points follow a clear form. . . . . . . 10 20 30 40 y 50 60 70 80 Positive Association (scatterplot) 2 4 6 8 10 12 14 x . . . . . . 60 40 20 y 80 100 Negative Association (scatterplot) 2 4 6 8 10 12 14 x . . . . . . -10 -5 0 y 5 10 15 NO Association (scatterplot) 2 4 6 8 10 12 14 x . . . . . . Do heavier people burn more energy? (Again) Describe the direction, form, and strength of the relationship between lean body mass and metabolic rate, as displayed in your plot. . . . . . . Solution The scatterplot shows a positive direction, linear form, and moderately strong association. . . . . . . Do heavier people burn more energy? (Again) The study of dieting described earlier collected data on the lean body mass (in kilograms) and metabolic rate (in calories) for both female and male subjects. Mass 36.1 54.6 48.5 42.0 50.6 42.0 Rate 995 1425 1396 1418 1502 1256 Sex F F F F F F Mass 40.3 33.1 42.4 34.5 51.1 41.2 Rate 1189 913 1124 1052 1347 1204 . Sex F F F F F F . . . . . More data Mass 51.9 46.9 62.0 62.9 Rate 1867 1439 1792 1666 Sex M M M M Mass 47.4 48.7 51.9 Rate 1322 1614 1460 . Sex M M M . . . . . a) Make a scatterplot of metabolic rate versus lean body mass for all 19 subjects. Use separate symbols to distinguish women and men. (This is a common method to compare two groups of individuals in a scatterplot) b) Does the same overall pattern hold for both women and men? What is the most important difference between women and men? . . . . . . 1200 1400 1600 female male 1000 Metabolic Rate (calories/day) 1800 Scatterplot 35 40 45 50 55 60 Lean Body Mass (kg) . . . . . . b) Solution For both men and women, the association is linear and positive. The women’s points show a stronger association. As a group, males typically have larger values for both variables (they tend to have more mass, and tend to burn more calories per day). . . . . . . Correlation The correlation measures the direction and strength of the linear relationship between two quantitative variables. Correlation is usually written as r . Suppose that we have data on variables x and y for n individuals. The values for the first individual are x1 and y1 , the values for the second individual are x2 and y2 , and so on. The means and standard deviations of the two variables are x̄ and Sx for the x-values, and ȳ and Sy for the y -values. The correlation r between x and y is 1 ∑ r= n−1 n i=1 ( xi − x̄ Sx )( yi − ȳ Sy . ) . . . . . Covariance You can compute the covariance, Sxy using the following formula: ∑n xi yi nx̄ ȳ Sxy = i=1 − n−1 n−1 . . . . . . Correlation (alternative formula) r= Sxy Sx Sy where r = correlation. Sxy = covariance. Sx = standard deviation of x. Sy = standard deviation of y . . . . . . . Example Five observations taken for two variables follow xi 4 6 11 3 16 yi 50 50 40 60 30 a) Develop a scatter diagram with x on the horizontal axis. b) Compute the sample covariance. c) Compute and interpret the sample correlation coefficient. . . . . . . 45 40 35 30 y 50 55 60 a) Scatterplot 4 6 8 10 12 14 16 x . . . . . . x̄ and ȳ First, let’s find x̄ and ȳ x̄ = ȳ = 4 + 6 + 11 + 3 + 16 =8 5 50 + 50 + 40 + 60 + 30 = 46 5 . . . . . . Sx Now, let’s find Sx and Sy Sx2 = (4 − 8)2 + (6 − 8)2 + (11 − 8)2 + (3 − 8)2 + (16 − 8)2 4 Sx2 = (−4)2 + (−2)2 + (3)2 + (−5)2 + (8)2 118 = = 29.5 4 4 Sx = 5.4313 . . . . . . Sy Sy2 = (50 − 46)2 + (50 − 46)2 + (40 − 46)2 + (60 − 46)2 + (30 − 46)2 4 Sy2 = (4)2 + (4)2 + (−6)2 + (14)2 + (−16)2 520 = = 130 4 4 Sy = 11.4017 . . . . . . Covariance and Correlation Finally, we find Sxy and r 5 ∑ xi yi = (4)(50) + (6)(50) + (11)(40) + (3)(60) + (16)(30) = 1600 i=1 ∑n Sxy = i=1 xi yi n−1 r= − nx̄ ȳ 1600 (5)(8)(46) = − = −60 n−1 4 4 Sxy −60 = = −0.9688 Sx Sy (5.4313)(11.4017) . . . . . . Coral reefs Exercise 4.2 discusses a study in which scientists examined data on mean sea surface temperatures (in degrees Celsius) and mean coral growth (in millimeters per year) over a several-year period at locations in the Red Sea. Here are the data: Sea Surface Temperature 29.68 29.87 30.16 30.22 30.48 30.65 30.90 Growth 2.63 2.58 2.60 2.48 2.26 2.38 2.26 . . . . . . a) Make a scatterplot. Which is the explanatory variable? b) Find the correlation r step-by-step. Explain how your value for r matches your graph in a). c) Enter these data into your calculator and use the correlation function to find r . . . . . . . Scatterplot 30.4 30.2 30.0 29.8 Coral Growth (mm) 30.6 30.8 Temperature is the explanatory variable. 2.3 2.4 2.5 2.6 Sea Surface Temperature . . . . . . x̄ and ȳ First, let’s find x̄ and ȳ x̄ = 29.68 + 29.87 + 30.16 + 30.22 + 30.48 + 30.65 + 30.90 = 30.28 7 ȳ = 2.63 + 2.58 + 2.60 + 2.48 + 2.26 + 2.38 + 2.26 = 2.4557 7 . . . . . . Sx Now, let’s find Sx and Sy Sx2 = (29.68 − 30.28)2 + ... + (30.65 − 30.28)2 + (30.90 − 30.28)2 6 Sx2 = 0.1845 Sx = 0.4296 . . . . . . Sy Sy2 = (2.63 − 2.4557)2 + ... + (2.38 − 2.4557)2 + (2.26 − 2.4557)2 6 Sy2 = 0.0249 Sy = 0.1578 . . . . . . Covariance Finally, we find Sxy and r 7 ∑ xi yi = (29.68)(2.63) + ... + (30.65)(2.38) + (30.90)(2.26) i=1 = 520.1504 ∑n Sxy nx̄ ȳ i=1 xi yi − n−1 n−1 520.1504 (7)(30.28)(2.4557) = − 6 6 = 86.6917 − 86.7516 = −0.0599 = . . . . . . Correlation r= Sxy −0.0599 = = −0.8835 Sx Sy (0.4296)(0.1578) This is consistent with the strong, negative association depicted in the scatterplot. c) Ti-84 will give a value of r = −0.8914. . . . . . . Example Five observations taken for two variables follow xi 1 2 3 4 5 yi 1 2 3 4 5 a) Develop a scatter diagram with x on the horizontal axis. b) Compute the sample covariance. c) Compute and interpret the sample correlation coefficient. . . . . . . 3 2 1 y 4 5 a) Scatterplot 1 2 3 4 5 x . . . . . . Covariance and Correlation x̄ = 3 ȳ∑= 3 5 i=1 xi yi Sx = 1.58113883 Sy = 1.58113883 = 55 ∑ Sxy = nx̄ ȳ xi yi − n−1 n−1 Sxy = 55 (5)(3)(3) − 4 4 Sxy = 13.75 − 11.25 = 2.5 r= Sxy 2.5 = =1 Sx Sy (1.58113883)(1.58113883) . . . . . . Facts about correlation 1. Correlation makes no distinction between explanatory and response variables. It makes no difference which variable you call x and which you call y in calculating the correlation. 2. Because r uses the standardized values of the observations, r does not change when we change the units of measurement of x, y, or both. The correlation r itself has no unit of measurement; it is just a number. 3. Positive r indicates positive association between the variables, and negative r indicates negative association. 4. The correlation r is always a number between −1 and 1. Values of r near 0 indicate a very weak linear relationship. Perfect correlation, r = 1 or r = −1, occurs only when the points on a scatterplot lie exactly on a straight line. . . . . . . Strong association but no correlation The gas mileage of an automobile first increases and then decreases as the speed increases. Suppose that this relationship is very regular, as shown by the following data on speed (miles per hour) and mileage (miles per gallon): Speed 30 40 50 60 70 Mileage 24 28 30 28 24 . . . . . . Strong association but no correlation (cont.) Make a scatterplot of mileage versus speed. Show that the correlation between speed and mileage is r = 0. Explain why the correlation is 0 even though there is a strong relationship between speed and mileage. . . . . . . 27 24 25 26 Mpg 28 29 30 Scatterplot 30 40 50 60 70 Speed Remember that correlation only measures the strength and direction of a linear relationship between two variables. . . . . . . Correlation x̄ = 50 Sx = 15.8113 ȳ∑= 26.8 Sy = 2.6832 5 x y = 6700 i=1 i i ∑ nx̄ ȳ xi yi − Sxy = n−1 n−1 Sxy = 6700 (5)(50)(26.8) − 4 4 Sxy = 1675 − 1675 = 0 r= Sxy 0 = =0 Sx Sy (15.8113)(2.6832) . . . . . . More facts about correlation 1. Correlation requires that both variables be quantitative, so that it makes sense to do the arithmetic indicated by the formula for r. 2. Correlation measures the strength of only the linear relationship between two variables. Correlation does not describe curved relationships between variables, no matter how strong they are. 3. Like the mean and the standard deviation, the correlation is not resistant: r is strongly affected by a few outlying observations. 4. Correlation is not a complete summary of two-variable data, even when the relationship between the variables is linear. You should give the means and standard deviations of both x and y along with the correlation. . . . . . . CHAPTER 5 REGRESSION . . . . . . Regression Line A regression line is a straight line that describes how a response variable y changes as an explanatory variable x changes. We often use a regression line to predict the value of y for a given value of x. . . . . . . Review of Straight Lines Suppose that y is a response variable (plotted on the vertical axis) and x is an explanatory variable (plotted on the horizontal axis). A straight line relating y to x has an equation of the form y = a + bx In this equation, b is the slope, the amount by which y changes when x increases by one unit. The number a is the intercept, the value of y when x = 0. . . . . . . City mileage, highway mileage We expect a car’s highway gas mileage (mpg) to be related to its city gas mileage. Data for all 1040 vehicles in the government’s 2010 Fuel Economy Guide give the regression line highway mpg = 6.554 + (1.016 x city mpg) for predicting highway mileage from city mileage. a) What is the slope of this line? Say in words what the numerical value of the slope tells you. b) What is the intercept? Explain why the value of the intercept is not statistically meaningful. c) Find the predicted highway mileage for a car that gets 16 miles per gallon in the city. Do the same for a car with a city mileage of 28 mpg. . . . . . . Solutions a) The slope is 1.016. On average, highway mileage increases by 1.016 mpg for each additional 1 mpg change in city mileage. b) The intercept is 6.554 mpg. This is the highway mileage for a nonexistent car that gets 0 mpg in the city. Although this interpretation is valid, such prediction would be invalid because it involves considerable extrapolation. c) For a car that gets 16 mpg in the city, we predict highway mileage to be: 6.554 + (1.016)(16) = 22.81 mpg. For a car that gets 28 mpg in the city, we predict highway mileage to be: 6.554 + (1.016)(28) = 35.002 mpg. . . . . . . What’s the line? You use the same bar of soap to shower each morning. The bar weighs 80 grams when it is new. Its weight goes down by 5 grams per day on the average. What is the equation of the regression line for predicting weight from days of use? . . . . . . Solution The equation is: weight = 80 − 5 × days The intercept is 80 grams (the initial weight), and the slope is −5 grams/day. . . . . . . Least-Squares Regression Line The least-squares regression line of y on x is the line that makes the sum of the squares of the vertical distances of the data points from the line as small as possible. . . . . . . Equation of the Least-Squares Regression Line We have data on an explanatory variable x and a response variable y for n individuals. From the data, calculate the means x̄ and ȳ and the standard deviations Sx and Sy of the two variables, and their correlation r . The least-squares regression line is the line ŷ = a + bx with slope b=r Sy Sx and intercept a = ȳ − bx̄ . . . . . . Coral reefs Exercises 4.2 and 4.8 discuss a study in which scientists examined data on mean sea surface temperatures (in degrees Celsius) and mean coral growth (in millimeters per year) over a several-year period at locations in the Red Sea. Here are the data: Sea Surface Temperature 29.68 29.87 30.16 30.22 30.48 30.65 30.90 Growth 2.63 2.58 2.60 2.48 2.26 2.38 2.26 . . . . . . a) Use your calculator to find the mean and standard deviation of both sea surface temperature x and growth y and the correlation r between x and y . Use these basic measures to find the equation of the least-squares line for predicting y from x. b) Enter the data into your software or calculator and use the regression function to find the least-squares line. The result should agree with your work in a) up to roundoff error. . . . . . . Solutions a) x̄ = 30.28 ȳ = 2.4557 r = −0.8914. Hence, Sx = 0.4296 Sy = 0.1578 Sy b=r = (−0.8914) Sx ( 0.1578 0.4296 ) = −0.3274 a = ȳ − bx̄ = 2.4557 − (−0.3274)(30.28) = 12.3693 b) Ti-84 gives: slope = - 0.3276 and intercept = 12.3758. . . . . . . Do heavier people burn more energy? We have data on the lean body mass and resting metabolic rate for 12 women who are subjects in a study of dieting. Lean body mass, given in kilograms, is a person’s weight leaving out all fat. Metabolic rate, in calories burned per 24 hours, is the rate at which the body consumes energy. Mass 36.1 54.6 48.5 42.0 50.6 42.0 Rate 995 1425 1396 1418 1502 1256 Mass 40.3 33.1 42.4 34.5 51.1 41.2 Rate 1189 913 1124 1052 1347 1204 . . . . . . a) Make a scatterplot that shows how metabolic rate depends on body mass. There is a quite strong linear relationship, with correlation r = 0.876. b) Find the least-squares regression line for predicting metabolic rate from body mass. Add this line to your scatterplot. c) Explain in words what the slope of the regression line tells us. d) Another woman has a lean body mass of 45 kilograms. What is her predicted metabolic rate? . . . . . . 900 1000 1100 1200 1300 Metabolic Rate (calories/day) 1400 1500 Scatterplot 35 40 Lean Body Mass (kg) 45 50 . . 55 . . . . Solutions b) the regression equation is ŷ = 201.2 + 24.026x where y = metabolic rate and x= body mass. c) The slope tells us that on the average, metabolic rate increases by about 24 calories per day for each additional kilogram of body mass. d) For x = 45 kg, the predicted metabolic rate is ŷ = 1282.4 calories per day. . . . . . . Facts about Least-Squares Regression 1. The distinction between explanatory and response variables is essential in regression. 2. The least-squares regression line always passes through the point (x̄, ȳ ) on the graph of y against x. 3. The square of the correlation, r 2 , is the fraction of the variation in the values of y that is explained by the least-squares regression of y on x. . . . . . . What’s my grade? In Professor Krugman’s economics course the correlation between the student’s total scores prior to the final examination and their final-examination scores is r = 0.5. The pre-exam totals for all students in the course have mean 280 and standard deviation 40. The final-exam scores have mean 75 and standard deviation 8. Professor Krugman has lost Julie’s final exam but knows that her total before the exam was 300. He decides to predict her final-exam score from her pre-exam total. a) What is the slope of the least-squares regression line of final-exam scores on pre-exam total scores in this course? What is the intercept? b) Use the regression line to predict Julie’s final-exam score. c) Julie doesn’t think this method accurately predicts how well she did on the final exam. Use r 2 to argue that her actual score could have been much higher (or much lower) than the predicted value. . . . . . . Solutions S 8 a) b = r Syy = (0.5) 40 = 0.1 a = ȳ − bx̄ = 75 − (0.1)(280) = 47. Hence, the regression equation is ŷ = 47 + 0.1x. b) Julie’s pre-final exam total was 300, so we would predict a final exam score of ŷ = 47 + (0.1)(300) = 77. c) Julie is right ... with a correlation of r = 0.5, r 2 = 0.25, so the regression line accounts for only 25% of the variability in student final exam scores. That is, the regression line doesn’t predict final exam scores very well. Julie’s score could, indeed, be much higher or lower than the predicted 77. . . . . . . Residuals A residual is the difference between an observed value of the response variable and the value predicted by the regression line. That is, a residual is the prediction error that remains after we have chosen the regression line: residual = observed y - predicted y residual = y − ŷ . . . . . . . Residual Plots A residual plot is a scatterplot of the regression residuals against the explanatory variable. Residual plots help us assess how well a regression line fits the data. . . . . . . Residuals by hand In Exercise 5.3 (page 115) you found the equation of the least-squares line for predicting coral growth y from mean sea surface temperature x. a) Use the equation to obtain the 7 residuals step-by-step. That is, find the prediction ŷ for each observation and then find the residual y − ŷ . b) Check that (up to roundoff error) the residuals add to 0. c) The residuals are the part of the response y left over after the straight-line tie between y and x is removed. Show that the correlation between the residuals and x is 0 (up to roundoff error). That this correlation is always 0 is another special property of least-squares regression. . . . . . . Solutions a) The residuals are computed in the table below using ŷ = −0.3276x + 12.3758. xi 29.68 29.87 30.16 30.22 30.48 30.65 30.90 yi 2.63 2.58 2.60 2.48 2.26 2.38 2.26 yˆi 2.65632 2.59038 2.495384 2.475728 2.390552 2.33486 2.25296 yi − yˆi - 0.022632 - 0.010388 0.104616 0.004272 - 0.130552 0.04514 0.00704 ∑ b) (yi − yˆi ) = −0.002504 (they sum to zero, except for rounding error. c) From software, the correlation between xi and yi − yˆi is −0.0000854, which is zero except for rounding. . . . . . . Do heavier people burn more energy? Return to the data of Exercise 5.4 (page 117) on lean body mass and metabolic rate. We will use these data to illustrate influence. a) Make a scatterplot of the data that is suitable for predicting metabolic rate from body mass, with two new points added. Point A: mass 42 kilograms, metabolic rate 1500 calories. Point B: mass 70 kilograms, metabolic rate 1400 calories. In which direction is each of these points an outlier? b) Add three least-squares regression lines to your plot: for the original 12 women, for the original women plus Point A, and for the original women plus Point B. Which new point is more influential for the regression line? Explain in simple language why each new point moves the line in the way your graph shows. . . . . . . 900 1000 1100 1200 1300 Metabolic Rate (calories/day) 1400 1500 Scatterplot A B 30 40 Lean Body Mass (kg) 50 60 . 70 . . . . . 1500 Least-squares regression lines 1000 1100 1200 1300 B original original + A original + B 900 Metabolic Rate (calories/day) 1400 A 30 40 50 60 70 Lean Body Mass (kg) . . . . . . Solutions a) Point A lies above the other points; that is, the metabolic rate is higher than we expect for the given body mass. Point B lies to the right of the other points; that is, it is an outlier in the x (mass) direction, and the metabolic rate is lower than we would expect. b) In the plot, the dashed blue line is the regression line for the original data. The dashed red line slightly that includes Point A; it has a very similar slope to the original line, but a slightly higher intercept, because Point A pulls the line up. The third line includes Point B, the more influential point; because Point B is an outlier in the x direction, it ”pulls” the line down so that it is less steep. . . . . . . Influential observations An observation is influential for a statistical calculation if removing it would markedly change the result of the calculation. The result of a statistical calculation may be of little practical use if it depends strongly on a few influential observations. Points that are outliers in either the x or the y direction of a scatterplot are often influential for the correlation. Points that are outliers in the x direction are often influential for the least-squares regression line. . . . . . . The endangered manatee Table 4.1 gives 33 years of data on boats registered in Florida and manatees killed by boats. If we made a scatterplot for this data set, it would show a strong positive linear relationship. The correlation is r = 0.951. a) Find the equation of the least-squares line for predicting manatees killed from thousands of boats registered. Because the linear pattern is so strong, we expect predictions from this line to be quite accurate - but only if conditions in Florida remain similar to those of the past 33 years. b) In 2009, experts predicted that the number of boats registered in Florida would be 975,000 in 2010. How many manatees do you predict would be killed by boats if there are 975,000 boats registered? Explain why we can trust this prediction. c) Predict manatee deaths if there were no boats registered in Florida. Explain why the predicted count of deaths is impossible. . . . . . . Table 4.1 Year 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 Boats 447 460 481 498 513 512 526 559 585 614 645 Manatees 13 21 24 16 24 20 15 34 33 33 39 Year 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 Boats 675 711 719 681 679 678 696 713 732 755 809 . Manatees 43 50 47 53 38 35 49 42 60 54 66 . . . . . Table 4.1 (cont.) Year 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 Boats 830 880 944 962 978 983 1010 1024 1027 1010 982 Manatees 82 78 81 95 73 69 79 92 73 90 97 . . . . . . Solutions a) The regression line is ŷ = −43.172 + 0.129x. b) If 975, 000 boats are registered, then by our scale, x = 975, and ŷ = −43.172 + (0.129)(975) = 82.6 manatees killed. The prediction seems reasonable, as long as conditions remain the same, because ”975” is within the space of observed values of x on which the regression line was based. That is, this is not extrapolation. c) If x = 0 (corresponding to no registered boats), then we would ”predict” −43.172 manatees to be killed by boats. This is absurd, because it is clearly impossible for fewer than 0 manatees to be killed. Note that x = 0 is well outside the range of observed values of x on which the regression line was based. . . . . . . Extrapolation Extrapolation is the use of a regression line for prediction far outside the range of values of the explanatory variable x that you used to obtain the line. Such predictions are often not accurate. . . . . . . Is math the key to success in college? A College Board study of 15,941 high school graduates found a strong correlation between how much math minority students took in high school and their later success in college. New articles quoted the head of the College Board as saying that ”Math is the gatekeeper for success in college.” Maybe so, but we should also think about lurking variables. What might lead minority students to take more or fewer high school math courses? Would these same factors influence success in college? . . . . . . Solution A student’s intelligence may be a lurking variable: stronger students (who are more likely to succeed when they get to college) are more likely to choose to take these math courses, while weaker students may avoid them. Other possible answers may be variations on this idea; for example, if we believe that success in college depends on a student’s self-confidence, and perhaps confident students are more likely to choose math courses. . . . . . . Lurking Variable A lurking variable is a variable that is not among the explanatory or response variables in a study and yet may influence the interpretation of relationships among those variables. . . . . . . Chapter 8 PRODUCING DATA: SAMPLING. . . . . . . Population, Sample, Sampling Design The population in a statistical study is the entire group of individuals about which we want information. A sample is a part of the population from which we actually collect information. We use a sample to draw conclusions about the entire population. A sampling design describes exactly how to choose a sample from the population. The first step in planning a sample survey is to say exactly what population we want to describe. The second step is to say exactly what we want to measure, that is, to give exact definitions of our variables. . . . . . . Customer satisfaction A department store mails a customer satisfaction survey to people who make credit card purchases at the store. This month, 45,000 people made credit card purchases. Surveys are mailed to 1000 of these people, chosen at random, and 137 people return the survey form. a) What is the population of interest for this survey? b) What is the sample? From what group is information actually obtained? . . . . . . Solutions a) The population is all 45,000 people who made credit card purchases. b) The sample is the 137 people who returned the survey form. . . . . . . How to sample badly The final step in planning a sample survey is the sampling design. A sampling design is a specific method for choosing a sample from the population. The easiest- but not the best - design just chooses individuals close at hand. A sample selected by taking the members of the population that are easiest to reach is called a convenience sample. Convenience samples often produce unrepresentative data. . . . . . . Bias The design of a statistical study is biased if it systematically favors certain outcomes. . . . . . . Voluntary response sample A voluntary response sample consists of people who choose themselves by responding to a broad appeal. Voluntary response samples are biased because people with strong opinions are most likely to respond. . . . . . . Sampling on campus You see a woman student standing in front of the student center, now and then stopping other students to ask them questions. She says that she is collecting student opinions for a class assignment. Explain why this sampling method is almost certainly biased. . . . . . . Solution It is a convenience sample; she is only getting opinions from students who are at the student center at a certain time of day. This might underrepresent some group: commuters, graduate students, or nontraditional students, for example. . . . . . . Simple Random Sampling A simple random sample (SRS) of size n consists of n individuals from the population chosen in such a way that every set of n individuals has an equal chance to be the sample actually selected. . . . . . . Random digits A table of random digits is a long string of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 with these two properties: 1. Each entry in the table is equally likely to be any of the 10 digits 0 through 9. 2. The entries are independent of each other. That is, knowledge of one part of the table gives no information about any other part. . . . . . . Using Table B to choose an SRS Label: Give each member of the population a numerical label of the same length. Table: To choose a SRS, read from Table B successive groups of digits of the length you used as labels. Your sample contains the individuals whose labels you find in the table. . . . . . . Apartment living You are planning a report on apartment living in a college town. You decide to select three apartment complexes at random for in-depth interviews with residents. Use software or Table B to select a simple random sample of 4 of the following apartment complexes. If you use Table B, start at line 122. . . . . . . Ashley Oaks Bay Pointe Beau Jardin Bluffs Brandon Place Briarwood Brownstone Burberry Place Cambridge Chauncey Village Country View Country Villa Crestview Del-Lynn Fairington Fairway Knolls Fowler Franklin Park Georgetown Greenacres Mayfair Village Nobb Hill Pemberly Courts Peppermill Pheasant Run River Walk Sagamore Ridge Salem Courthouse Village Square Waterford Court . . . . . . Solution 01 02 03 04 05 06 07 08 09 10 Ashley Oaks Bay Pointe Beau Jardin Bluffs Brandon Place Briarwood Brownstone Burberry Place Cambridge Chauncey Village 11 12 13 14 15 16 17 18 19 20 Country View Country Villa Crestview Del-Lynn Fairington Fairway Knolls Fowler Franklin Park Georgetown Greenacres . 21 22 23 24 25 26 27 28 29 30 . Mayfair Village Nobb Hill Pemberly Courts Peppermill Pheasant Run River Walk Sagamore Ridge Salem Courthouse Village Square Waterford Court . . . . Solution (cont.) With Table B, enter at line 122 and choose 13 = Crestview, 15 = Fairington, 05 = Brandon Place, and 29 = Village Square. . . . . . . Inference about the Population The purpose of a sample is to give us information about a larger population. The process of drawing conclusions about a population on the basis of sample data is called inference because we infer information about the population from what we know about the sample. Inference from convenience samples or voluntary response samples would be misleading because these methods of choosing a sample are biased. We are almost certain that the sample does not fairly represent the population. The first reason to rely on random sampling is to eliminate bias in selecting samples from the list of available individuals. . . . . . . Sampling frame The list of individuals from which a sample is actually selected is called the sampling frame. Ideally, the frame should list every individual in the population, but in practice this is often difficult. A frame that leaves out part of the population is a common source of undercoverage. Suppose that a sample of households in a community is selected at random from the telephone directory. What households are omitted from this frame? What types of people do you think are likely to live in these households? These people will probably be underrepresented in the sample. . . . . . . Solution This design would omit households without telephones or with unlisted numbers. Such households would likely be made up of poor individuals (who cannot afford a phone), those who choose not to have phones, and those who do not wish to have their phone number published. . . . . . . Cautions about sample surveys Random selection eliminates bias in the choice of a sample from a list of the population. When the population consists of human beings, however, accurate information from a sample requires more than a good sampling design. To begin, we need an accurate and complete list of the population. Because such a list is rarely available, most samples suffer from some degree of undercoverage. A sample survey of households, for example, will miss not only homeless people but prison inmates and students in dormitories. An opinion poll conducted by calling landline telephone numbers will miss households that have only cell phones as well as households without a phone. The results of national sample surveys therefore have some bias if the people not covered differ from the rest of the population. A more serious source of bias in most sample surveys is nonresponse, which occurs when a selected individual cannot be contacted or refuses to cooperate. . . . . . . Nonresponse Academic sample surveys, unlike commercial polls, often discuss nonresponse. A survey of drivers began by randomly sampling all listed residential telephone numbers in the United States. Of 45,956 calls to these numbers, 5029 were completed. What was the rate of nonresponse for this sample? (Only one call was made to each number. Nonresponse would be lower if more calls were made.) . . . . . . Solution 5029 The response rate was 45956 = 0.1094, so the nonresponse rate was 1 − 0.1094 = 0.8906 . . . . . . Undercoverage and nonresponse Undercoverage occurs when some groups in the population are left out of the process of choosing the sample. Nonresponse occurs when an individual chosen for the sample can’t be contacted or refuses to participate. . . . . . . CHAPTER 9 Producing Data: Experiments . . . . . . Observation vs Experiment An observational study observes individuals and measures variables of interest but does not attempt to influence the responses. The purpose of an observational study is to describe some group or situation. An experiment, on the other hand, deliberately imposes some treatment on individuals in order to observe their responses. The purpose of an experiment is to study whether the treatment causes a change in the response. . . . . . . Subjects, Factors, Treatments The individuals studied in an experiment are often called subjects, particularly when they are people. The explanatory variables in an experiment are often called factors. A treatment is any specific experimental condition applied to the subjects. If an experiment has more than one factor, a treatment is a combination of specific values of each factor. . . . . . . Sealing food packages A manufacturer of food products uses package liners that are sealed at the top by applying heated jaws after the package is filled. The customer peels the sealed pieces apart to open the package. What effect does the temperature of the jaws have on the force needed to peel the liner? To answer this question, engineers obtain 20 pairs of pieces of package liner. They seal five pairs at each of 250◦ F, 275◦ F, 300◦ F, and 335◦ F. Then they measure the force needed to peel each seal. a) What are the individuals? b) There is one factor (explanatory variable). What is it, and what are its values? c) What is the response variable? . . . . . . Solutions a) The individuals are pairs of pieces of package liner. b) The explanatory variable is temperature of jaws, with four values: 250◦ F, 275◦ F, 300◦ F, and 335◦ F. c) The response variable is the force needed to peel each seal. . . . . . . An industrial experiment A chemical engineer is designing the production process for a new product. The chemical reaction that produces the product may have higher or lower yield, depending on the temperature and stirring rate in the vessel in which the reaction takes place. The engineer decides to investigate the effects of combinations of two temperatures (50◦ C and 60◦ C) and three stirring rates (60 rpm, 90 rpm, and 120 rpm) on the yield of the process. She will process two batches of the product at each combination of temperature and stirring rate. a) What are the individuals and the response variable in this experiment? b) How many factors are there? How many treatments? . . . . . . Solutions a) The individuals are batches of the product; the response variable is the yield of a batch. b) There are two factors (temperature and stirring rate) and six treatments (temperature-stirring rate combinations). 60 rpm 90 rpm 120 rpm 50◦ Treatment 1 Treatment 3 Treatment 5 60◦ Treatment 2 Treatment 4 Treatment 6 . . . . . . Randomized Comparative Experiment An experiment that uses both comparison of two or more treatments and random assignment of subjects to treatments is a randomized comparative experiment. . . . . . . Completely Randomized Design In a completely randomized experimental design, all the subjects are allocated at random among all the treatments. . . . . . . Adolescent obesity Adolescent obesity is a serious health risk affecting more than 5 million young people in the United States alone. Laparoscopic adjustable gastric banding has the potential to provide a safe and effective treatment. Fifty adolescents between 14 and 18 years old with a body mass index higher than 35 were recruited from the Melbourne, Australia, community for the study. Twenty-five were randomly selected to undergo gastric banding, and the remaining 25 were assigned to a supervised lifestyle intervention program involving diet, exercise, and behavior modification. All subjects were followed for two years and their weight loss was recorded. a) Outline the design of this experiment. What is the response variable? b) Carry out the random assignment of 25 adolescents to the gastric-banding group using software or Table B, starting at line 130. . . . . . . Solutions a) The diagram is provided. The response variable is weight loss. b) Label the students from 01 to 50, and pick 25 to receive Treatment 1 (the rest will receive Treatment 2). If using Table B, line 130, the sample is 05, 16, 48, 17, 40, 20, 19, 45, 32, 41, 04, 25, 29, 43, 37, 39, 31, 50, 18, 07, 13, 33, 30, 21, 36. . . . . . . Diagram Group 1 25 Subjects Treatment 1 Gastric banding Random Assignment Compare weight loss Group 2 25 Subjects Treatment 2 Lifestyle intervention . . . . . . The Logic of Randomized Comparative Experiments Randomized comparative experiments are designed to give good evidence that differences in the treatments actually cause the differences we see in the response. The logic is as follows: I Random assignment of subjects forms groups that should be similar in all respects before the treatments are applied. . . . . . . The Logic of Randomized Comparative Experiments Randomized comparative experiments are designed to give good evidence that differences in the treatments actually cause the differences we see in the response. The logic is as follows: I Random assignment of subjects forms groups that should be similar in all respects before the treatments are applied. I Comparative design ensures that influences other than the experimental treatments operate equally on all groups. . . . . . . The Logic of Randomized Comparative Experiments Randomized comparative experiments are designed to give good evidence that differences in the treatments actually cause the differences we see in the response. The logic is as follows: I Random assignment of subjects forms groups that should be similar in all respects before the treatments are applied. I Comparative design ensures that influences other than the experimental treatments operate equally on all groups. I Therefore, differences in average response must be due either to the treatments or to the play of chance in the random assignment of subjects to the treatments. . . . . . . Principles of Experimental Design The basic principles of statistical design of experiments are: I Control the effects of lurking variables on the response, most simply by comparing two or more treatments. . . . . . . Principles of Experimental Design The basic principles of statistical design of experiments are: I Control the effects of lurking variables on the response, most simply by comparing two or more treatments. I Randomize - use chance to assign subjects to treatments. . . . . . . Principles of Experimental Design The basic principles of statistical design of experiments are: I Control the effects of lurking variables on the response, most simply by comparing two or more treatments. I Randomize - use chance to assign subjects to treatments. I Use enough subjects in each group to reduce chance variation in the results. . . . . . . Statistical Significance An observed effect so large that it would rarely occur by chance is called statistically significant. . . . . . . The Placebo and Double-Blind Methods A placebo is a dummy treatment. Experiments in medicine and psychology often give a placebo to a control group because just being in an experiment can affect responses. In a double-blind experiment, neither the subjects nor the people who interact with them know which treatment each subject is receiving. . . . . . . Testosterone for older men As men age, their testosterone levels gradually decrease. This may cause a reduction in lean body mass, an increase in fat, and other undesirable changes. Do testosterone supplements reverse some of these effects? A study in the Netherlands assigned 237 men aged 60 to 80 with low or low-normal testosterone levels to either a testosterone supplement or a placebo. The report in the Journal of the American Medical Association described the study as a ”double-blind, randomized, placebo-controlled trial”. Explain each of these terms to someone who knows no statistics. . . . . . . Solution ”Double-blind” means that the treatment (testosterone or placebo) assigned to a subject was unknown to both the subject and those responsible for assessing the effectiveness of that treatment. ”Randomized” means that the patients were randomly assigned to receive either the testosterone supplement or a placebo. ”Placebo-controlled” means that some of the subjects were given placebos. Even though these possess no medical properties, some subjects may show improvement or benefits just as a result of participating in the experiment; the placebos allow those doing the study to observe this effect. . . . . . . Matched Pairs Design A matched pairs design compares two treatments. Choose pairs of subjects that are as closely matched as possible. Use chance to decide which subject in a pair gets the first treatment. The other subject in that pair gets the other treatment. Sometimes each ”pair” in a matched pairs design consists of just one subject, who gets both treatments one after the other. Use chance to decide the order in which subjects receive the treatments. . . . . . . Comparing breathing frequencies in swimming Researchers from the United Kingdom studied the effect of two breathing frequencies on performance times and on several physiological parameters in front crawl swimming. The breathing frequencies were one breath every second stroke (B2) and one breath every fourth stroke (B4). Subjects were 10 male collegiate swimmers. Each subject swam 200 meters, once with breathing frequency B2 and once on a different day with breathing frequency B4. Describe the design of this matched pairs experiment, including the randomization required by this design. . . . . . . Solution Each swimmer swims one time using each breathing technique (B2 and B4). A coin is tossed to determine the order in which these techniques are used. . . . . . . Alcohol and heart attacks Many studies have found that people who drink alcohol in moderation have lower risk of heart attacks than either nondrinkers or heavy drinkers. Does alcohol consumption also improve survival after a heart attack? One study followed 1913 people who were hospitalized after severe heart attacks. In the year before their heart attacks, 47% of these people did not drink, 36% drank moderately, and 17% drank heavily. After four years, fewer of the moderate drinkers had died. a) Is this an observational study or an experiment? Why? What are the explanatory and response variables? b) Suggest some lurking variables that may be confounded with the drinking habits of the subjects. The possible confounding makes it difficult to conclude that drinking habits explain death rates. . . . . . . Solution a) This is an observational study; the subjects chose their own ”treatments” (how much to drink). The explanatory variable is alcohol consumption, and the response variable is whether or not a subject dies. b) Many answers are possible. For example, some nondrinkers might avoid drinking because of other health concerns. We do not know what kind of alcohol (beer? wine? whiskey?) the subjects were drinking. . . . . . . Confounding Two variables (explanatory variables or lurking variables) are confounded when their effects on a response variable cannot be distinguished from each other. . . . . . .