#set document(title: "10.7 Confidence Interval for Mean", author: "OpenStax") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 10.7#h(0.6em)Confidence Interval for Mean #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Prerequisites] Areas Under Normal Distributions, Sampling Distribution of the Mean, Introduction to Estimation, Introduction to Confidence Intervals #linebreak() #linebreak() ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Learning Objectives] + Use the inverse normal distribution calculator to find the value of z to use for a confidence interval + Compute a confidence interval on the mean when σ is known + Determine whether to use a t distribution or a normal distribution + Compute a confidence interval on the mean when σ is estimated ] #link("https://onlinestatbook.com/2/estimation/meanM.html")[Video presentation of this section (onlinestatbook.com)] When you compute a confidence interval on the mean, you compute the mean of a sample in order to estimate the mean of the population. Clearly, if you already knew the population mean, there would be no need for a confidence interval. However, to explain how confidence intervals are constructed, we are going to work backwards and begin by assuming characteristics of the population. Then we will show how sample data can be used to construct a confidence interval. Assume that the weights of 10-year-old children are normally distributed with a mean of 90 and a standard deviation of 36. What is the sampling distribution of the mean for a sample size of 9? Recall from the section on the sampling distribution of the mean that the mean of the #strong[sampling distribution] is μ and the #strong[standard error of the mean] is #math.equation(block: true, alt: "σ sub M equals the fraction σ over the square root of N")[$σ_(M) = frac(σ, sqrt(N))$] For the present example, the sampling distribution of the mean has a mean of 90 and a standard deviation of 36/3 = 12. Note that the standard deviation of a sampling distribution is its standard error. Figure 1 shows this distribution. The shaded area represents the middle 95% of the distribution and stretches from 66.48 to 113.52. These limits were computed by adding and subtracting 1.96 standard deviations to/from the mean of 90 as follows: 90 - (1.96)(12) = 66.48 #linebreak() 90 + (1.96)(12) = 113.52 #linebreak() The value of 1.96 is based on the fact that 95% of the area of a normal distribution is within 1.96 standard deviations of the mean; 12 is the standard error of the mean. #figure(figph[Normal sampling distribution of the mean with mean 90 and standard error 12, x-axis labeled from 42 to 138 in steps of 12. The middle 95% of the area, from 66.48 to 113.52, is shaded blue.], alt: "Normal sampling distribution of the mean with mean 90 and standard error 12, x-axis labeled from 42 to 138 in steps of 12. The middle 95% of the area, from 66.48 to 113.52, is shaded blue.", caption: [Figure 1. The sampling distribution of the mean for N=9. The middle 95% of the distribution is shaded.]) Figure 1 shows that 95% of the means are no more than 23.52 units (1.96 standard deviations) from the mean of 90. Now consider the probability that a sample mean computed in a random sample is within 23.52 units of the population mean of 90. Since 95% of the distribution is within 23.52 of 90, the probability that the mean from any given sample will be within 23.52 of 90 is 0.95. This means that if we repeatedly compute the mean (M) from a sample, and create an interval ranging from M - 23.52 to M + 23.52, this interval will contain the population mean 95% of the time. In general, you compute the 95% confidence interval for the mean with the following formula: Lower limit = M - Z#sub[.95]σ#sub[M] #linebreak() #linebreak() Upper limit = M + Z#sub[.95]σ#sub[M] where Z#sub[.95] is the number of standard deviations extending from the mean of a normal distribution required to contain 0.95 of the area and σ#sub[M] is the standard error of the mean. If you look closely at this formula for a confidence interval, you will notice that you need to know the standard deviation (σ) in order to estimate the mean. This may sound unrealistic, and it is. However, computing a confidence interval when σ is known is easier than when σ has to be estimated, and serves a pedagogical purpose. Later in this section we will show how to compute a confidence interval for the mean when σ has to be estimated. Suppose the following five numbers were sampled from a normal distribution with a standard deviation of 2.5: 2, 3, 5, 6, and 9. To compute the 95% confidence interval, start by computing the mean and standard error: #linebreak() M = (2 + 3 + 5 + 6 + 9)/5 = 5. #linebreak() σ#sub[M] = #math.equation(block: false, alt: "the fraction 2.5 over the square root of 5")[$frac(2.5, sqrt(5))$]= 1.118. #linebreak() Z#sub[.95] can be found using the normal distribution calculator and specifying that the shaded area is 0.95 and indicating that you want the area to be between the cutoff points. As shown in Figure 2, the value is 1.96. If you had wanted to compute the 99% confidence interval, you would have set the shaded area to 0.99 and the result would have been 2.58. #linebreak() #figure(figph[Inverse normal distribution calculator screenshot: mean 0, Sd 1, shaded area .95 selected Between, showing that 95% of the area lies between -1.9600 and 1.9600, with the region between shaded blue.], alt: "Inverse normal distribution calculator screenshot: mean 0, Sd 1, shaded area .95 selected Between, showing that 95% of the area lies between -1.9600 and 1.9600, with the region between shaded blue.", caption: [Figure 2. 95% of the area is between -1.96 and 1.96.]) Normal Distribution Calculator The confidence interval can then be computed as follows: Lower limit = 5 - (1.96)(1.118)= 2.81 #linebreak() Upper limit = 5 + (1.96)(1.118)= 7.19 You should use the t distribution rather than the normal distribution when the variance is not known and has to be estimated from sample data. When the sample size is large, say 100 or above, the t distribution is very similar to the standard normal distribution. However, with smaller sample sizes, the t distribution is leptokurtic, which means it has relatively more scores in its tails than does the normal distribution. As a result, you have to extend farther from the mean to contain a given proportion of the area. Recall that with a normal distribution, 95% of the distribution is within 1.96 standard deviations of the mean. Using the t distribution, if you have a sample size of only 5, 95% of the area is within 2.78 standard deviations of the mean. Therefore, the standard error of the mean would be multiplied by 2.78 rather than 1.96. The values of t to be used in a confidence interval can be looked up in a table of the t distribution. A small version of such a table is shown in Table 1. The first column, df, stands for degrees of freedom, and for confidence intervals on the mean, df is equal to N - 1, where N is the sample size. Table 1. Abbreviated t table. #figure(table( columns: 3, align: left, inset: 6pt, table.header([df], [0.95], [0.99]), [2], [4.303], [9.925], [3], [3.182], [5.841], [4], [2.776], [4.604], [5], [2.571], [4.032], [8], [2.306], [3.355], [10], [2.228], [3.169], [20], [2.086], [2.845], [50], [2.009], [2.678], [100], [1.984], [2.626], )) You can also use the "inverse t distribution" calculator to find the t values to use in confidence intervals. You will learn more about the t distribution in the next section. Assume that the following five numbers are sampled from a normal distribution: 2, 3, 5, 6, and 9 and that the standard deviation is not known. The first steps are to compute the sample mean and variance: #linebreak() #linebreak()         M = 5 #linebreak()         s#super[2] = 7.5 #linebreak() #linebreak() The next step is to estimate the standard error of the mean. If we knew the population variance, we could use the following formula: #math.equation(block: true, alt: "σ sub M equals the fraction σ over the square root of N")[$σ_(M) = frac(σ, sqrt(N))$] #linebreak() Instead we compute an estimate of the standard error (s#sub[M]): #linebreak() #math.equation(block: true, alt: "s sub M equals the fraction s over the square root of N")[$s_(M) = frac(s, sqrt(N))$] = 1.225 The next step is to find the value of t. As you can see from Table 1, the value for the 95% interval for df = N - 1 = 4 is 2.776. The confidence interval is then computed just as it is when σ#sub[M]. The only differences are that s#sub[M] and t rather than σ#sub[M] and Z are used. Lower limit = 5 - (2.776)(1.225) = 1.60 #linebreak() Upper limit = 5 + (2.776)(1.225) = 8.40 More generally, the formula for the 95% confidence interval on the mean is: Lower limit = M - (t#sub[CL])(s#sub[M]) #linebreak() Upper limit = M + (t#sub[CL])(s#sub[M]) where M is the sample mean, t#sub[CL] is the t for the confidence level desired (0.95 in the above example), and s#sub[M] is the estimated standard error of the mean. We will finish with an analysis of the #link("https://onlinestatbook.com/2/case_studies/stroop.html")[Stroop Data]. Specifically, we will compute a confidence interval on the mean difference score. Recall that 47 subjects named the color of ink that words were written in. The names conflicted so that, for example, they would name the ink color of the word "blue" written in red ink. The correct response is to say "red" and ignore the fact that the word is "blue." In a second condition, subjects named the ink color of colored rectangles. Table 2. Response times in seconds for 10 subjects. #figure(table( columns: 3, align: left, inset: 6pt, table.header([Naming Colored Rectangle], [Interference], [Difference]), [17], [38], [21], [15], [58], [43], [18], [35], [17], [20], [39], [19], [18], [33], [15], [20], [32], [12], [20], [45], [25], [19], [52], [33], [17], [31], [14], [21], [29], [8], )) Table 2 shows the time difference between the interference and color-naming conditions for 10 of the 47 subjects. The mean time difference for all 47 subjects is 16.362 seconds and the standard deviation is 7.470 seconds. The standard error of the mean is 1.090. A t table shows the critical value of t for 47 - 1 = 46 degrees of freedom is 2.013 (for a 95% confidence interval). Therefore the confidence interval is computed as follows: Lower limit = 16.362 - (2.013)(1.090) = 14.17 #linebreak() Upper limit = 16.362 + (2.013)(1.090) = 18.56 Therefore, the interference effect (difference) for the whole population is likely to be between 14.168 and 18.555 seconds.