Chapter 8: Confidence Intervals 8.1 Confidence Intervals Confidence Interval: Mean A confidence interval is a range of numbers that is likely contains the true mean. 95% confidence interval for the mean: P( −1.96 ≤ Z ≤ 1.96) = 0.95 z 0.025 = 1.96 [8.1] Substitute the z - value based on the standard error of the mean P( −1.96 ≤ X −µ ≤ 1.96) = 0.95 σ/ n σ σ P( X − 1.96 ≤ µ ≤ X + 1.96 ) = 0.95 n n [8.2] [8.3] 1.96 σ n Lower limit = sample mean – margin of error ( ) Upper limit = sample mean + margin of error Remember that the sample mean X is normally distributed, if the sample size n is large (central limit theorem). A confidence interval for the mean is the sample mean plus and minus the margin of error ( 誤差範圍,誤差幅度 -margin of error Lower limit +margin of error Sample mean X Upper limit Since the sample mean changes every time you redo the sampling. The confidence interval also changes. A 95% confidence interval is an interval around the sample mean and there is a 95% chance that the population mean is contains in the interval. ). http://www.answers.com/topic/confidence-interval 95 out of 100 intervals contain the population mean µ A general expression for the confidence interval for a mean: σ σ X ± zα / 2 ( is the standard error of the means) [8.5] n n where zα / 2 = 1.96 for 95% confidence interval, and zα / 2 = 2.58 for 99% confidence interval, α = 0.05 for 95% confidence interval and .005 for 99% C. I. In Eq. [8.5] we assume we know the population standard deviation σ. When we do not have σ, we use the sample standard deviation, s. That is the confidence interval becomes X ± zα / 2 s n [8.7] Eq. [8.7] works when the sample size is large, n = 30 or larger, or when the population distribution is normal. Learning activity 8.1-1 Confidence interval for a mean • Open kbs.xls!Data. • Calculate the mean and standard deviation of the Kbs variable by using AVERAGE() AND STDEV(). • Use Excel to calculate the 95% confidence interval for the mean. • Use MegaStat | Descriptive Statistics to calculate the confidence interval • See kbs.xls!Solution1 for the solution. • Calculate 99% confidence interval by using Excel and with MegaStat • compare the 95% and 99% confidence intervals (kbs.xls!Solution1a). Confidence Interval: Proportion Calculate the confidence interval for a proportion by p( 1 - p) p ± zα /2 n p( 1 - p) ( is the standard error for the proportion) [8.8] n where p is the sample proportion. We do not know π in [7.5]. Learning Activity 8.1-2 Confidence Interval for a Proportion • Open kbs.xls!p. • Use Excel to calculate the 95% confidence interval for the mean. • Use MegaStat | Descriptive Statistics to calculate the confidence interval • See kbs.xls!Solution2 for the solution. Note: 95% margin of error is approximately SQRT(1/n) p( 1-p) p( 1-p) = 1.96 ≈ 1/ n n n Since sqrt(p(1-p)) is largest when p = 0.5 and Sqrt(0.5*0.5) = 0.5, 1.96*05 approximately equal to 1. zα / 2 0.6 sqrt(p(1-p)) 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 p 0.6 0.7 0.8 0.9 1 σ zα / 2σ E = zα / 2 ( ) ⇒ n= n E 2 [8.9] A company wants to estimate the mean amount each customer purchases within $2 with 95% confidence. A small sample indicates that the standard deviation is about $5.5. Learning Activity 8.2-1 Sample size for a mean • Open SampleSize.xls!Start. • Calculate the sample size by using the Eq. [8.9] • MegaStat | confidence Intervals | Sample Size – Mean • See SampleSize.xls!solution1. Sample Size : Proportion zα / 2 n = π (1 − π ) E 2 [8.10] where π is the population proportion. Since you do no know the true proportion π, you can estimate π by taking samples. Or use π = 0.5, since π(1 - π) is largest when π = 0.5. This will give you a conservative n value. 0.6 sqrt(p(1-p)) 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 p 0.6 0.7 0.8 0.9 1 A company wants to estimate with a margin of error of 4% the proportion of people who will vote for a candidate, using a 95% confidence level. Since the company does not know the true proportion, it uses π = 0.5. Learning Activity 8.2-2 Sample size for a proportion • Open SampleSize.xls!Start. • Calculate the sample size by using the Eq. [8.10] • MegaStat | confidence Intervals | Sample Size – p • See sampleSize.xls!Solution2. • See sampleSize.xls!Why p of .5. Learning Activity 8.B-1 Confidence Interval Simulation • Open CLT-CI.xls. You can see that sample means derived from uniform random number have a near normal distribution. We calculate the confidence intervals for the mean of 30 uniform distributed random numbers (between 0 and 100). We repeat such calculation 600 times and get 600 intervals. We can see that about 95% of 600 intervals contains the true mean of 50. Note that the variance for uniform random variable is σ = SQRT((ymax-ymin)2/12) =SQRT((100)^2)/12) = 28.87. Margin of error = 1.96*28.87/sqrt(30) = 10.33