Cofidece Itervals Berli Che Deartmet of Comuter Sciece & Iformatio Egieerig Natioal Taiwa Normal Uiversity Referece: 1. W. Navidi. Statistics for Egieerig ad Scietists. Chater 5 & Teachig Material
Itroductio We have discussed oit estimates: ˆ as a estimate of a success robability, as a estimate of oulatio mea, μ (Beroulli trials) These oit estimates are almost ever exactly equal to the true values they are estimatig I order for the oit estimate to be useful, it is ecessary to describe just how far off from the true value it is likely to be Remember that oe way to estimate how far our estimate is from the true value is to reort a estimate of the stadard deviatio, or ucertaity, i the oit estimate I this chater, we ca obtai more iformatio about the estimatio recisio by comutig a cofidece iterval whe the estimate is ormally distributed Statistics-Berli Che 2
Revisit: The Cetral Limit Theorem The Cetral Limit Theorem Let 1,, be a radom samle from a oulatio with mea μ ad variace σ 2 ( is large eough) 1 + L + Let = be the samle mea Let S = 1 + L+ be the sum of the samle observatios. The if is sufficietly large, ~ σ N μ, 2 samle mea is aroximately ormal! 2 Ad ~ N ( μ, σ ) aroximately S Statistics-Berli Che 3
Examle Assume that a large umber of ideedet ubiased measuremets, all usig the same rocedure, are made o the diameter of a isto. The samle mea of the measuremets is 14.0 cm (comig from a ormal oulatio due to the Cetral Limit Theorem ), ad the ucertaity i this quatity, which is the stadard deviatio σ of the samle mea, is 0.1 cm So, we have a high level of cofidece that the true diameter is i the iterval (13.7, 14.3). This is because it is highly ulikely that the samle mea will differ from the true diameter by more tha three stadard deviatios μ. 96 σ 1 μ 1 σ μ μ+1 σ μ+ 1. 96 σ Statistics-Berli Che 4
Large-Samle Cofidece Iterval for a Poulatio Mea Recall the revious examle: Sice the oulatio mea will ot be exactly equal to the samle mea of 14, it is best to costruct a cofidece iterval aroud 14 that is likely to cover the oulatio mea We ca the quatify our level of cofidece that the oulatio mea is actually covered by the iterval To see how to costruct a cofidece iterval, let μ rereset the ukow oulatio mea ad let σ 2 be the ukow oulatio variace. Let 1,, 100 be the 100 diameters of the istos. The observed value of is the mea of a large samle, ad the Cetral Limit Theorem secifies that it comes from a ormal distributio with mea μ ad whose stadard deviatio is σ = σ / 100 Statistics-Berli Che 5
Illustratio of Caturig True Mea Here is a ormal curve, which reresets the distributio of. The middle 95% of the curve, extedig a distace of 1.96 σ o either side of the oulatio mea μ, is idicated. The followig illustrates what haes if lies withi the middle 95% of the distributio: 95% of the samles that could have bee draw fall ito this category 95% cofidece iterval Statistics-Berli Che 6
Illustratio of Not Caturig True Mea If the samle mea lies outside the middle 95% of the curve: Oly 5% of all the samles that could have bee draw fall ito this category. For those more uusual samles the 95% cofidece iterval ±1.96σ fails to cover the true oulatio mea μ 95% cofidece iterval Statistics-Berli Che 7
Comutig a 95% Cofidece Iterval The 95% cofidece iterval (CI) is ±1.96σ So, a 95% CI for the mea is 14 ± 1.96 (0.1). We ca use the samle stadard deviatio as a estimate for the oulatio stadard deviatio, sice the samle size is large We ca say that we are 95% cofidet, or cofidet at the 95% level, that the oulatio mea diameter for istos lies, betwee 13.804 ad 14.196 Warig: The methods described here require that the data be a radom samle from a oulatio. Whe used for other samles, the results may ot be meaigful Statistics-Berli Che 8
Questio? Does this 95% cofidece iterval actually cover the oulatio mea μ? It deeds o whether this articular samle haeed to be oe whose mea (i.e. samle mea) came from the middle 95% of the distributio or whether it was a samle whose mea (i.e. samle mea) was uusually large or small, i the outer 5% of the oulatio There is o way to kow for sure ito which category this articular samle falls I the log ru, if we reeated these cofidece itervals over ad over, the 95% of the samles will have meas (i.e. samle mea) i the middle 95% of the oulatio. The 95% of the cofidece itervals will cover the oulatio mea Statistics-Berli Che 9
Extesio We are ot always iterested i comutig 95% cofidece itervals. Sometimes, we would like to have a differet level of cofidece We ca use this reasoig to comute cofidece itervals with various cofidece levels Suose we are iterested i 68% cofidece itervals, the we kow that the middle 68% of the ormal distributio is i a iterval that exteds 1.0 σ o either side of the oulatio mea μ It follows that a iterval of the same legth aroud secifically, will cover the oulatio mea for 68% of the samles that could ossibly be draw For our examle, a 68% CI for the diameter of istos is 14.0 ± 1.0(0.1), or (13.9, 14.1) Statistics-Berli Che 10
100(1 - α)% CI Let 1,, be a large ( > 30) radom samle from a oulatio with mea μ ad stadard deviatio σ, so that is aroximately ormal. The a level 100(1 - α)% cofidece iterval for μ is ± z α / 2 α / 2 is the z-score that cuts off a area of α / i the right-had tail where σ = σ /. Whe the value of σ is ukow, it ca be relaced with the samle stadard deviatio s σ z 2 Statistics-Berli Che 11
Z-Table E.g., ± z α / 2 σ ad α = 0.05 => z α / 2 = 1.96 Statistics-Berli Che 12
Particular CI s s ± is a 68% iterval for μ s ±1. 645 is a 90% iterval for μ s ±1. 96 is a 95% iterval for μ s is a 99% iterval for μ ± 2. 58 s ± 3 is a 99.7% iterval for μ Note that eve for large samles, the distributio of is oly aroximately ormal, rather tha exactly ormal. Therefore, the levels stated for cofidece iterval are aroximate. Statistics-Berli Che 13
Examle (CI Give a Level) Examle 5.1: The samle mea ad stadard deviatio for the fill weights of 100 boxes are = 12.05 ad s = 0.1. Fid a 85% cofidece iterval for the mea fill weight of the boxes. Aswer: To fid a 85% CI, set 1 - α =.85, to obtai α = 0.15 ad α/2 = 0.075. We the look i the table for z 0.075, the z-score that cuts off 7.5% of the area i the right-had tail. We fid z 0.075 = 1.44. We aroximate σ s / = 0.01. So the 85% CI is 12.05 ± (1.44)(0.01) or (12.0356, 12.0644). Statistics-Berli Che 14
Aother Examle (The Level of CI) Questio: There is a samle of 50 micro-drills with a average lifetime (exressed as the umber of holes drilled before failure) was 12.68 with a stadard deviatio of 6.83. Suose a egieer reorted a cofidece iterval of (11.09, 14.27) but eglected to secify the level. What is the level of this cofidece iterval? Aswer: The cofidece iterval has the form ± zα / 2s /. We will solve for z α/2, ad the cosult the z table to determie the value of α. The uer cofidece limit of 14.27 therefore satisfies the equatio 14.27 = 12.68 + z α/2 (6.83/ 50 ). Therefore, z α/2 = 1.646. From the z table, we determie that α/2, the area to the right of 1.646, is aroximately 0.05. The level is 100(1 - α)%, or 90%. Statistics-Berli Che 15
More About CI s (1/2) The cofidece level of a iterval measures the reliability of the method used to comute the iterval A level 100(1 - α)% cofidece iterval is oe comuted by a method that i the log ru will succeed i i coverig the oulatio mea a roortio 1 - α of all the times that it is used I ractice, there is a decisio about what level of cofidece to use This decisio ivolves a trade-off, because itervals with greater cofidece are less recise Statistics-Berli Che 16
More About CI s (2/2) 100 samles 68% cofidece itervals 95% cofidece itervals 99.7% cofidece itervals Statistics-Berli Che 17
Probability vs. Cofidece I comutig CI, such as the oe of diameter of istos: (13.804, 14.196), it is temtig to say that the robability that μ lies i this iterval is 95% The term robability refers to radom evets, which ca come out differetly whe exerimets are reeated 13.804 ad 14.196 are fixed ot radom. The oulatio mea is also fixed. The mea diameter is either i the iterval or ot There is o radomess ivolved So, we say that we have 95% cofidece that the oulatio mea is i this iterval Statistics-Berli Che 18
Determiig Samle Size Back to the examle of diameter of istos: We had a CI of (13.804, 14.196). This iterval secifies the mea to withi ±0.196. Now assume that the iterval is too wide to be useful Questio: Assume that it is desirable to roduce a 95% cofidece iterval that secifies the mea to withi ± 0.1 To do this, the samle size must be icreased. The width of a CI is secified by ± z α / 2σ /. If we kow α ad σ is secified, the we ca fid the eeded to get the desired width For our examle, the z α/2 = 1.96 ad the estimated stadard deviatio of the oulatio is 1. So, 0.1 =1.96(1)/, the the accomlishes this is 385 (always roud u) Statistics-Berli Che 19
Oe-Sided Cofidece Itervals (1/2) We are ot always iterested i CI s with a uer ad lower boud For examle, we may wat a cofidece iterval o battery life. We are oly iterested i a lower boud o the battery life. There is ot a uer boud o how log a battery ca last (cofidece iterval =(low boud, ) ) With the same coditios as with the two-sided CI, the level 100(1-α)% lower cofidece boud for μ is z α σ. ad the level 100(1-α)% uer cofidece boud for μ is + z α σ. Statistics-Berli Che 20
Oe-Sided Cofidece Itervals (2/2) Examle: Oe-sided Cofidece Iterval (for Low Boud) (.645σ, ) 1 Statistics-Berli Che 21
Cofidece Itervals for Proortios The method that we discussed i the last sectio (Sec. 5.1) was for mea from ay oulatio from which a large samle is draw Whe the oulatio has a Beroulli distributio, this exressio takes o a secial form (the mea is equal to the success robability) If we deote the success robability as ad the estimate ˆ for as which ca be exressed by ˆ = A 95% cofidece iterval (CI) for is ˆ 1.96 (1 ) < < : the samle size :umber of samle items i that success = + + L+ 1 ˆ + 1.96 2 (1 ). Statistics-Berli Che 22
Commets The limits of the cofidece iterval cotai the ukow oulatio roortio We have to somehow estimate this ( ) E.g., usig ˆ Recet research shows that a slight modificatio of ad a estimate of imrove the iterval Defie ~ = + 4 Ad ~ + = ~ 2 Statistics-Berli Che 23
CI for Let be the umber of successes i ideedet Beroulli trials with success robability, so that ~ Bi, ( ) The a 100(1 - α)% cofidece iterval for is ~ ± z α / 2 ~ (1 ~ ~ ). If the lower limit is less tha 0, relace it with 0. If the uer limit is greater tha 1, relace it with 1 Statistics-Berli Che 24
Small Samle CI for a Poulatio Mea The methods that we have discussed for a oulatio mea reviously require that the samle size be large Whe the samle size is small, there are o geeral methods for fidig CI s If the oulatio is aroximately ormal, a robability distributio called the Studet s t distributio ca be used to comute cofidece itervals for a oulatio mea μ σ = σ / μ μ s / Statistics-Berli Che 25
More o CI s What ca we do if is the mea of a small samle? If the samle size is small, s may ot be close to σ, ad may ot be aroximately ormal. If we kow othig about the oulatio from which the small samle was draw, there are o easy methods for comutig CI s However, if the oulatio is aroximately ormal, will be aroximately ormal eve whe the samle size is small. It turs out that we ca use the quatity ( μ) /( s / ), but sice s may ot be close to σ, this quatity istead has a Studet s t distributio with -1 degrees of freedom, which we deote t 1 Statistics-Berli Che 26
Studet s t Distributio (1/2) Let 1,, be a small ( < 30) radom samle from a ormal oulatio with mea μ. The the quatity ( μ). s / has a Studet s t distributio with -1 degrees of freedom (deoted by t -1 ). Whe is large, the distributio of the above quatity is very close to ormal, so the ormal curve ca be used, rather tha the Studet s t Statistics-Berli Che 27
Studet s t Distributio (2/2) Plots of robability desity fuctio of studet s t curve for various of degrees The ormal curve with mea 0 ad variace 1 (z curve) is lotted for comariso The t curves are more sread out tha the ormal, but the amout of extra sread out decreases as the umber of degrees of freedom icreases Statistics-Berli Che 28
More o Studet s t Table A.3 called a t table, rovides robabilities associated with the Studet s t distributio Statistics-Berli Che 29
Examles Questio 1: A radom samle of size 10 is to be draw from a ormal distributio with mea 4. The Studet s t statistic t = ( 4) /( s / 10) is to be comuted. What is the robability that t > 1.833? Aswer: This t statistic has 10 1 = 9 degrees of freedom. From the t table, P(t > 1.833) = 0.05 Questio 2: Fid the value for the distributio whose lower-tail robability is 0.01 Aswer: Look dow the colum headed with 0.01 to the row corresodig to 14 degrees of freedom. The value for t = 2.624. This value cuts off a area, or robability, of 1% i the uer tail. The value whose lower-tail robability is 1% is -2.624 t 14 Statistics-Berli Che 30
Studet s t CI Let 1,, be a small radom samle from a ormal oulatio with mea μ. The a level 100(1 - α)% CI for μ is ± t 1, α / 2 s. Two-sided CI To be able to use the Studet s t distributio for calculatio ad cofidece itervals, you must have a samle that comes from a oulatio that it aroximately ormal Statistics-Berli Che 31
Other Studet s t CI s Let 1,, be a small radom samle from a ormal oulatio with mea μ The a level 100(1 - α)% uer cofidece boud for μ i s + t 1, α. oe-sided CI The a level 100(1 - α)% lower cofidece boud for μ is t 1, α s Occasioally a small samle may be take from a ormal oulatio whose stadard deviatio σ is kow. I these cases, we do ot use the Studet s t curve, because we are ot aroximatig σ with s. The CI to use here, is the oe usig the z table, that we discussed i the first sectio μ μ σ = σ /. oe-sided CI Statistics-Berli Che 32
Determie the Aroriateess of Usig t Distributio (1/2) We have to decide whether a oulatio is aroximately ormal before usig t distributio to calculate CI A reasoable way is costruct a boxlot or dotlot of the samle If these lots do ot reveal a strog asymmetry or ay outliers, the it most cast the Studet s t distributio will be reliable Examle 5.9: Is it aroriate to use t distributio to calculate the CI for a oulatio mea give a a radom samle with 15 items show below 580, 400, 428, 825, 850, 875, 920, 550, 575, 750, 636, 360, 590, 735, 950. es! Statistics-Berli Che 33
Determie the Aroriateess of Usig t Distributio (2/2) Examle 5.20: Is it aroriate to use t distributio to calculate the CI for a oulatio mea give a a radom samle with 11 items show below 38.43, 38.43, 38.39, 38.83, 38.45, 38.35, 38.43, 38.31, 38.32, 38.38, 38.50. No! Statistics-Berli Che 34
CI for the Differece i Two Meas (1/2) We also ca estimate the differece betwee the meas μ ad μ of two oulatios ad the other oe from, each of which resectively has samle We ca draw two ideedet radom samles, oe from ad meas ad The costruct the CI for μ μ by determiig the distributio of Recall the robability theorem: Let ad be ideedet, with ( 2 ) ~ N, σ ad The + ( 2 2 ) μ + μ, σ + σ ~ N ( 2 ) μ N μ, σ ~ Ad ( 2 2 ) μ μ, σ + σ ~ N Statistics-Berli Che 35
CI for the Differece i Two Meas (2/2) Let 1, K, be a large radom samle of size from a oulatio with mea μ ad stadard deviatio σ, ad let 1, K, be a large radom samle of size from a oulatio with mea μ ad stadard deviatio σ. If the two samles are ideedet, the a level 100(1- α)% CI for μ is μ ± z 2 σ α / 2 + σ 2. Two-sided CI α = 0.05 Whe the values of σ ad are ukow, they ca be relaced with the samle stadard deviatios s ad s σ Statistics-Berli Che 36
Statistics-Berli Che 37 CI for Differece Betwee Two Proortios (1/3) Recall that i a Beroulli oulatio, the mea is equal to the success robability (oulatio roortio) Let be the umber of successes i ideedet Beroulli trials with success robability, ad let be the umber of successes i ideedet Beroulli trials with success robability, so that ad The samle roortios ( ), Bi ~ ( ), Bi ~ = = N N ) (1, ~ ˆ ) (1, ~ ˆ followig from the cetral limit theorem ( ad are large) + = N ) (1 ) (1, ~ ˆ ˆ
CI for Differece Betwee Two Proortios (2/3) The differece satisfies the followig iequality for 95% of all ossible samles ˆ ˆ 1.96 < (1 < ) + (1 ) Two-sided CI ˆ ˆ + 1.96 (1 ) + (1 ) Traditioally i the above iequality, is relaced by ˆ ad is relaced by ˆ Statistics-Berli Che 38
Statistics-Berli Che 39 CI for Differece Betwee Two Proortios (3/3) Adjustmet (I imlemetatio): Defie The 100(1-α)% CI for the differece is If the lower limit of the cofidece iterval is less tha -1, relace it with -1 If the uer limit of the cofidece iterval is greater tha 1, relace it with 1 ~ 1) / ( ~ ad, ~ 1) / ( ~ 2, ~ 2, ~ + = + = + = + =. ) ~ (1 ~ ) ~ (1 ~ ~ ~ 2 / z + ± α
Small-Samle CI for Differece Betwee Two Meas (1/2) Let 1, K, be a radom samle of size from a ormal oulatio with mea μ ad stadard deviatio σ, ad let 1, K, be a radom samle of size from a ormal oulatio with mea μ ad stadard deviatio σ. Assume that the two samles are ideedet. If the oulatios do ot ecessarily have the same variace, a level 100(1- α)% CI for μ is μ The umber of degrees of freedom, ν, is give by (rouded dow to the earest iteger) 2 2 2 2 s ± tv, α / 2 + v = s 2 2 2 ( s / ) ( s / ) 1 + + s 1 2 s 2. Two-sided CI Statistics-Berli Che 40
Small-Samle CI for Differece Betwee Two Meas (2/2) If we further kow the oulatios ad are kow to have early the same variace. The a 100(1-α)% CI for μ is μ ± t s + 2, α / 2 1 1 The quatity is the ooled variace, give by s +. Two-sided CI s 2 = ( 1) s 2 + + ( 2 1) s 2. Do t assume the oulatio variace are equal just because the samle variace are close Statistics-Berli Che 41
CI for Paired Data (1/3) The methods discussed reviously for fidig CI s o the basis of two samles have required the samles are ideedet However, i some cases, it is better to desig a exerimet so that each item i oe samle is aired with a item i the other Examle: Tread wear of tires made of two differet materials Statistics-Berli Che 42
( ) ( ) CI for Paired Data (2/3) Let 1, 1, K,, be samle airs. Let Di = i i. Let μ ad μ rereset the oulatio meas for ad, resectively. We wish to fid a CI for the differece μ μ. Let μ D rereset the oulatio mea of the differeces, the μ D = μ μ. It follows that a CI for μ D will also be a CI for μ μ Now, the samle D 1, K, D is a radom samle from a oulatio with mea μ D, we ca use oe-samle methods to fid CIs for μ D Statistics-Berli Che 43
CI for Paired Data (3/3) Let D 1, K, D be a small radom samle ( < 30) of differeces of airs. If the oulatio of differeces is aroximately ormal, the a level 100(1-α)% CI for D ± t 1, α / 2 s D. μ D is If the samle size is large, a level 100(1-α)% CI for is μ D D ± z σ α / 2 D. σ D I ractice, is aroximated with s D Statistics-Berli Che 44
Summary We leared about large ad small CI s for meas We also looked at CI s for roortios We discussed large ad small CI s for differeces i meas We exlored CI s for differeces i roortios Statistics-Berli Che 45