310 likes | 435 Views
Stick Tossing and Confidence Intervals. David Sklar San Francisco State University dsklar@sfsu.edu. Bruce Cohen Lowell High School, SFUSD bic@cgl.ucsf.edu http://www.cgl.ucsf.edu/home/bic. Asilomar - December 2006. Ver. 0.5. Estimating a Probability. An Old Problem:
E N D
Stick Tossing and Confidence Intervals David Sklar San Francisco State University dsklar@sfsu.edu Bruce Cohen Lowell High School, SFUSD bic@cgl.ucsf.edu http://www.cgl.ucsf.edu/home/bic Asilomar - December 2006 Ver. 0.5
Estimating a Probability An Old Problem: When a thin stick of unit length is “randomly” tossed onto a grid of parallel lines spaced one unit apart what is the probability that the stick lands crossing a grid line? We would like to take a purely experimental and statistical approach to the problem of finding, or at least estimating, the desired probability. Our experiments will consist of tossing a stick some fixed number of times, keeping track of how many times the stick lands crossing a grid line (the data), and computing the percentage of times this event occurs (a statistic). Basic statistical theory will help us understand how to interpret these results.
Plan Estimating a simple probability Toss sticks, gather data Estimating the probability Estimating the uncertainty in the estimate of the probability Confidence intervals and what they mean Background material The average and standard deviation of a list of numbers Histograms, what they are and what they aren’t The average and standard deviation of a histogram The normal curve Box models and histograms for the sum of the draws The Central Limit Theorem Where does the procedure for finding confidence intervals come from? Why does it work? A mathematical model for the data The mathematics of the model Sketch of a proof of a special case of the Central Limit Theorem
Conclusions: Based on this data an approximate 68% confidence interval for the probability that the stick lands crossing a line is 47.3% 63.9% an approximate 95% confidence interval is 39.0% 72.2% Estimating the Probability: A Sample Calculation Result: 20 line crossings in 36 tosses
63.9% 47.3% 74.6% 58.8% 61.1% 44.5% 28 77.8% 6.9% 84.7% 70.9% 23 63.9% 8.0% 71.2% 55.9% 25 69.4% 7.7% 77.1% 61.7% 24 66.7% 7.9% 74.6% 58.8% 27 75.0% 7.2% 82.2% 67.8% 23 63.9% 8.0% 71.2% 55.9% 21 58.3% 8.2% 66.5% 50.1% 50% 70% 40% 60% 80% 68% Confidence Intervals for 10 Experiments (36 tosses per experiment) estimated cross prob SE 20 55.6% 8.3% 24 66.7% 7.9% 19 52.8% 8.3%
62.5% 67.5% an approximate 95% confidence interval is 60.0% 70.0% Pooling the data Result: 234 line crossings in 360 (independent) tosses Conclusions: Based on this data an approximate 68% confidence interval for the probability that the stick lands crossing a line is
62.5% 67.5% 68% Confidence Intervals for 10 Experiments (36 tosses per experiment) estimated cross prob error 20 55.6% 8.3% 63.9% 47.3% 24 66.7% 7.9% 74.6% 58.8% 19 52.8% 8.3% 61.1% 44.5% 28 77.8% 6.9% 84.7% 70.9% 23 63.9% 8.0% 71.2% 55.9% 25 69.4% 7.7% 77.1% 61.7% 24 66.7% 7.9% 74.6% 58.8% 27 75.0% 7.2% 82.2% 67.8% 23 63.9% 8.0% 71.2% 55.9% 21 58.3% 8.2% 66.5% 50.1% 234 65.0% 2.5% 50% 70% 40% 60% 80%
0 ? ?? 1 Where Does the Procedure for Finding Confidence Intervals Come From? As with all “real world” applications of mathematics we begin with a Mathematical Model. Box Model The number of line crossings in n tosses of the stick is like the Sum of values of n draws at random with replacement from a box with two kinds of numbered tickets. Those numbered 1 correspond to the stick landing crossing a line, and those numbered 0 to not crossing. The percentage of tickets numbered 1 in the box is not known. The set oftickets in the box is called the population, and the (unknown) % of 1’s in the population is a parameter. The n drawn tickets are a sample, and the % of 1’s in the sample is a statistic. This unknown percentage corresponds to the probability that a stick lands crossing a line. Note: this kind of box is called a zero–one box.
The Mathematics of the Model The goal for the rest of the talk is to develop the mathematics of the box model. We first review some basic background material which we then use to understand the behavior of the sum of the draws from a box of known composition. Finally we use this understanding to see why the confidence levels come from areas under the normal curve.
25 35 The Average and Standard Deviation of a List of Numbers Example List: 21, 28, 30, 30, 34, 37 The SD measures the spread. The mean measures the “center” of the list. The average is the balance point. The SD measures the spread of the list about the mean. It has the same units as the values in the list. It is a natural scale for the list: we are often more interested in how many SD’s a value is from the mean than in the value itself.
The Average and Standard Deviation of a List of Numbers For a list consisting of just 0’s and 1’s we have: and with some algebra we can show that We can now re-interpret the procedure for estimating our probability
Properties of The Average and Standard Deviation • If we add a constant, B, to each element of a • list the average of the new list is the old average + B. • If we multiply each element of a list by a constant, • A, the average of the new list is A times the old average. • If we add a constant, B, to each element of a • list the SD of the new list is the old SD. • If we multiply each element of a list by a constant, • A, the SD of the new list is |A| times the old SD.
Standard Units We are often more interested in how many SD’s a value is from the mean than in the value itself. For example: 37 is 1.4 SD’s above the average or 28 is 0.4 SD’s below the average. The value of an element in Standard Units is the the number of SD’s it is above (positive), or below (negative) the mean. To convert a value to standard units use value in standard units Example List: 21, 28, 30, 30, 34, 37 with average 30 and SD 5 In Standard Units: -1.8, -0.4, 0, 0, 0.8, 1.4 A list in standard units will have mean 0 and SD 1. Adding a constant to each element of a list or multiplying each element by a constant will not change the values of the elements in standard units. For many lists roughly 68% of the values lie within 1 SD of the mean and 95% lie within 2 SD’s.
density class intervals # % (% /point) 2.0 20 - 38 5 13.9 0.8 38 - 50 50 - 74 16 44.4 1.9 1.5 74 - 90 6 16.7 1.1 90 - 100 3 8.3 0.8 1.0 Density (% per point) 0.5 0.0 scores 20 40 60 80 100 13.9% 16.7% 16.7% 44.4% 8.3% (1.4) (0.8) (1.0) (0.8) (1.9) From Lists to Histograms Example: 36 Exam Scores 23, 29, 30, 31, 35, 38, 40, 41, 42, 45, 46, 51, 52, 54, 55, 55, 57, 58, 59, 60, 61, 63, 69, 70, 70, 71, 71, 74, 75, 75, 82, 85, 86, 91, 91, 93. Note: Av = 59.1, SD = 18.9 6 16.7 1.4 Endpoint convention: class intervals contain left endpoints, but not right endpoints A Histogram represents the percentages by areas (not by heights). A histogram is not a bar chart.
Bar Chart of Scores Histogram of Scores 44.4% 2.0 40 1.5 30 1.0 Density (% per point) 20 % of total papers 16.7% 16.7% 13.9% 0.5 10 8.3% 8.3% 0 0.0 20 38 50 74 90 100 scores scores 20 40 60 80 100 16.7% 13.9% 16.7% 44.4% (1.9) (1.4) (1.0) (0.8) (0.8) A Histogram is Not A Bar Chart A Histogram represents the percentages by areas (not by heights). A histogram is not a bar chart.
2.0 (1.9) 1.5 (1.4) (1.0) 1.0 Density (% per point) (0.8) (0.8) 0.5 8.3% 0.0 scores Av = 60.5 SD = 19 For many histograms roughly 68% of the area lies within 1 SD of the mean and 95% lies within 2 SD’s. 20 40 60 80 100 16.7% 13.9% 16.7% 44.4% The Average and Standard Deviation of a Histogram To find the mean or average of a histogram first list the center of each class interval then multiply each by the area of the block above it and finally sum. Class intervals: 20 to 38, 38 to 50, 50 to 74, 74 to 90, 90 to 100 List of midpoints: 29, 44, 62, 82, 95 To find the standard deviation of a histogram find the squared deviations of the center of each class interval, then multiply each by the area of its corresponding block, then sum, and finally take the square root. [Note for the original data: Av = 59.1, SD = 18.9]
2.0 1.5 Density (% per point) 1.0 Av = 60.5 0.5 SD = 19 0.0 scores -3 -2 -1 1 2 3 0 Standard Units Histograms and Standard Units
Area (percent) Height (% per Std.U.) The Normal Curve The normal curve was discovered by Abraham De Moivre around 1720. Around 1870 Adolph Quetelet had the idea of using it as an ideal histogram to which histograms for data could be compared. Many histograms follow the normal curve and many do not. From: Freedman, Pisani, and Purves, Statistics, 3rd Ed.
2.0 1.5 Density (% per point) 1.0 Av = 60.5 0.5 SD = 19 0.0 scores -3 -2 -1 1 2 3 0 Standard Units Histograms, Standard Units, and the Normal curve
Data Histograms and Probability Histograms Discrete data convention From: Freedman, Pisani, and Purves, Statistics, 3rd ed.
Data Histograms and Probability Histograms for the Sum of the Draws
The Central Limit Theorem There are many Central Limit Theorems. We state two in terms of box models. The second is a special case of the first and it covers the model we are dealing with in our stick tossing problem. It goes back to the early eighteenth century. When drawing at random with replacement from a box of numbered tickets (with bounded range), the probability histogram for the sum of the draws will follow the standard normal curve, even if the the contents of the box do not. The histogram must be put into standard units, and the number of draws must be reasonably large. De Moivre – La Place version: When drawing at random with replacement from a zero-one box, the probability histogram for the sum of the draws will follow the standard normal curve, even if the the contents of the box do not. The histogram must be put into standard units, and the number of draws must be reasonably large.
provides a box model for counting the number of heads in n tosses of a fair coin. 1 0 Histogram for the box 100 50 0 0 1 The Normal Curve and Probability Histograms for the Sum of the Draws From: Freedman, Pisani, and Purves
The Normal Curve and Probability Histograms for the Sum of the Draws From: Freedman, …
Histogram for the box 1 2 9 The Normal Curve and Probability Histograms for the Sum of the Draws From: Freedman, …
The Central Limit Theorems When drawing at random with replacement from a box of numbered tickets (with bounded range), the probability histogram for the sum (and average) of the draws will follow the standard normal curve, even if the the contents of the box do not. The histogram must be put into standard units, and the number of draws must be reasonably large. De Moivre – La Place version: When drawing at random with replacement from a zero-one box, the probability histogram for the sum (and average) of the draws will follow the standard normal curve, even if the the contents of the box do not. The histogram must be put into standard units, and the number of draws must be reasonably large. The probability histogram for the average of the draws, when put in standard units is the same as for the sum because multiplying each value of the sum by 1/(# of draws) won’t change the corresponding values in standard units.
Estimated SE for the average True SE for the average of the draws 1 True Population Average Standard units Where Does the 68 % Confidence Level Come From? Sample Average Since the estimated SE for the average computed from sample is, on average, about equal to the true SE a 68% confidence interval will cover the true population mean whenever the sample mean is within 1 SE of the true mean. The probability of this happening is, by the central limit theorem, the area within 1 standard unit of 0 under the normal curve, and this area is about 68%.
How to Prove The De Moivre – La Place Version of The Central Limit Theorem Show that the probability that the sum of n draws at random with replacement from a zero-one box is exactly k given by the binomial formula Then using “Stirling’s Formula”
Use the series for the log to show that, Which implies How to Prove The De Moivre – La Place Version of The Central Limit Theorem -- continued The limiting processes in these steps require some care. Both k and n must go to infinity together in a fixed relationship to each other, and we need to understand why values of x for which |x|>npq are unimportant.
Bibliography • Freedman, Pisani, & Purves, Statistics, 3rd Ed., W.W. Norton, New York, • 1998 • W. Feller, An Introduction to Probability Theory and Its Applications, Volume I, 2nd Ed., John Wiley & Sons, New York, London, Sydney, 1957 3. F. Mosteller, Fifty Challenging Problems in Probability with Solutions, Addison-Wesley, Palo Alto, 1965. 4. http://www-history.mcs.st-andrews.ac.uk/Biographies/De_Moivre.html 5. R Development Core Team, R: A language and environment for statistical computing, R Foundation for Statistical Computing, Vienna, Austria, 2006, <http://www.R-project.org>