#set document(title: "12.1 Single 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")) == 12.1#h(0.6em)Single Mean #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Prerequisites] #link("https://onlinestatbook.com/2/logic_of_hypothesis_testing/logic_hypothesis.html")[Logic of Hypothesis Testing], Normal Distributions, Areas Under Normal Distributions, Sampling Distribution of the Mean, Introduction to Sampling Distributions, t Distribution #linebreak() #linebreak() ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Learning Objectives] + Compute the probability of a sample mean being at least as high as a specified value when σ is known + Compute a two-tailed probability + Compute the probability of a sample mean being at least as high as a specified value when σ is estimated + State the assumptions required for item 3 above ] This section shows how to test the null hypothesis that the population mean is equal to some hypothesized value. For example, suppose an experimenter wanted to know if people are influenced by a subliminal message and performed the following experiment. Each of nine subjects is presented with a series of 100 pairs of pictures. As a pair of pictures is presented, a subliminal message is presented suggesting the picture that the subject should choose. The question is whether the (population) mean number of times the suggested picture is chosen is equal to 50. In other words, the null hypothesis is that the population mean (μ) is 50. The (hypothetical) data are shown in Table 1. The data in Table 1 have a sample mean (M) of 51. Thus the sample mean differs from the hypothesized population mean by 1. Table 1. Distribution of scores. #figure(table( columns: 1, align: left, inset: 6pt, [Frequency], [45], [48], [49], [49], [51], [52], [53], [55], [57], )) The significance test consists of computing the probability of a sample mean differing from μ by one (the difference between the hypothesized population mean and the sample mean) or more. The first step is to determine the sampling distribution of the mean. As shown in a previous section, the mean and standard deviation of the sampling distribution of the mean are μ#sub[M] = μ and #math.equation(block: true, alt: "σ sub M equals the fraction σ over the square root of N")[$σ_(M) = frac(σ, sqrt(N))$] respectively. It is clear that μ#sub[M] = 50. In order to compute the standard deviation of the sampling distribution of the mean, we have to know the population standard deviation (σ). The current example was constructed to be one of the few instances in which the standard deviation is known. In practice, it is very unlikely that you would know σ and therefore you would use s, the sample estimate of σ. However, it is instructive to see how the probability is computed if σ is known before proceeding to see how it is calculated when σ is estimated. For the current example, if the null hypothesis is true, then based on the binomial distribution, one can compute that variance of the number correct is σ#super[2] = Nπ(1-π) = 100(0.5)(1-0.5) = 25. Therefore, σ = 5. For a σ of 5 and an N of 9, the standard deviation of the sampling distribution of the mean is 5/3 = 1.667. Recall that the standard deviation of a sampling distribution is called the standard error. To recap, we wish to know the probability of obtaining a sample mean of 51 or more when the sampling distribution of the mean has a mean of 50 and a standard deviation of 1.667. To compute this probability, we will make the assumption that the sampling distribution of the mean is normally distributed. We can then use the normal distribution calculator as shown in Figure 1. #linebreak() #figure(figph[Normal distribution calculator screenshot for the subliminal-message example: Mean 50, Sd 1.667, on an axis labeled 43.3 to 56.7, with Above 51 selected. Everything to the right of 51 is shaded blue and the calculator reports Shaded area: 0.274293 — the one-tailed probability of a sample mean of 51 or more.], alt: "Normal distribution calculator screenshot for the subliminal-message example: Mean 50, Sd 1.667, on an axis labeled 43.3 to 56.7, with Above 51 selected. Everything to the right of 51 is shaded blue and the calculator reports Shaded area: 0.274293 — the one-tailed probability of a sample mean of 51 or more.", caption: [Figure 1. Probability of a sample mean being 51 or greater.]) Notice that the mean is set to 50, the standard deviation to 1.667, and the area above 51 is requested and shown to be 0.274. Therefore, the probability of obtaining a sample mean of 51 or larger is 0.274. Since a mean of 51 or higher is not unlikely under the assumption that the subliminal message has no effect, the effect is not significant and the null hypothesis is not rejected. The test conducted above was a one-tailed test because it computed the probability of a sample mean being one or more points higher than the hypothesized mean of 50 and the area computed was the area #emph[above] 51. To test the two-tailed hypothesis, you would compute the probability of a sample mean differing by one or more in either direction from the hypothesized mean of 50. You would do so by computing the probability of a mean being less than or equal to 49 or greater than or equal to 51. The results of the normal distribution calculator are shown in Figure 2. #figure(figph[The same normal calculator with Mean 50 and Sd 1.667, now with Outside 49 or 51 selected, so both tails are shaded blue and the middle is left white. Shaded area: 0.548586 — the two-tailed probability, exactly twice the one-tailed value.], alt: "The same normal calculator with Mean 50 and Sd 1.667, now with Outside 49 or 51 selected, so both tails are shaded blue and the middle is left white. Shaded area: 0.548586 — the two-tailed probability, exactly twice the one-tailed value.", caption: [Figure 2. Probability of a sample mean being less than or equal to 49 or greater than or equal to 51.]) As you can see, the probability is 0.548 which, as expected, is twice the probability of 0.274 shown in Figure 1. Before normal calculators such as the one illustrated above were widely available, probability calculations were made based on the standard normal distribution. This was done by computing Z based on the formula #math.equation(block: true, alt: "Z equals the fraction M minus μ over σ sub M")[$Z = frac(M − μ, σ_(M))$] where Z is the value on the standard normal distribution, M is the sample mean, μ is the hypothesized value of the mean, and σ#sub[M] is the standard error of the mean. For this example, Z = (51-50)/1.667 = 0.60. Use the normal calculator, with a mean of 0 and a standard deviation of 1, as shown below. #figure(figph[Normal distribution calculator screenshot titled Normal Distribution with Mean 0 and Sd 1 on an axis from -4 to 4, with Above .60 selected. The area to the right of 0.60 is shaded blue and reported as Shaded area: 0.274253 — the same one-tailed probability reached through the standardized Z of (51-50)/1.667 = 0.60.], alt: "Normal distribution calculator screenshot titled Normal Distribution with Mean 0 and Sd 1 on an axis from -4 to 4, with Above .60 selected. The area to the right of 0.60 is shaded blue and reported as Shaded area: 0.274253 — the same one-tailed probability reached through the standardized Z of (51-50)/1.667 = 0.60.", caption: [Figure 3. Calculation using the standardized normal distribution.]) Notice that the probability (the shaded area) is the same as previously calculated (for the one-tailed test). As noted, in real-world data analyses it is very rare that you would know σ and wish to estimate μ. Typically σ is not known and is estimated in a sample by s, and σ#sub[M] is estimated by s#sub[M]. For our next example, we will consider the data in the #link("https://onlinestatbook.com/2/case_studies/adhd.html")["ADHD Treatment]" case study. These data consist of the scores of 24 children with ADHD on a delay of gratification (DOG) task. Each child was tested under four dosage levels. Table 2 shows the data for the placebo (0 mg) and highest dosage level (0.6 mg) of methylphenidate. Of particular interest here is the column labeled "Diff" that shows the difference in performance between the 0.6 mg (D60) and the 0 mg (D0) conditions. These difference scores are positive for children who performed better in the 0.6 mg condition than in the control condition and negative for those who scored better in the control condition. If methylphenidate has a positive effect, then the mean difference score in the population will be positive. The null hypothesis is that the mean difference score in the population is 0. Table 2. DOG scores as a function of dosage. #figure(table( columns: 3, align: left, inset: 6pt, table.header([D0], [D60], [Diff]), [57], [62], [5], [27], [49], [22], [32], [30], [-2], [31], [34], [3], [34], [38], [4], [38], [36], [-2], [71], [77], [6], [33], [51], [18], [34], [45], [11], [53], [42], [-11], [36], [43], [7], [42], [57], [15], [26], [36], [10], [52], [58], [6], [36], [35], [-1], [55], [60], [5], [36], [33], [-3], [42], [49], [7], [36], [33], [-3], [54], [59], [5], [34], [35], [1], [29], [37], [8], [33], [45], [12], [33], [29], [-4], )) To test this null hypothesis, we compute t using a special case of the following formula: #math.equation(block: true, alt: "t equals the fraction statistic minus hypothesized value over estimated standard error of the statistic")[$t = frac("statistic" − "hypothesized value", "estimated standard error of the statistic")$] The special case of this formula applicable to testing a single mean is #math.equation(block: true, alt: "t equals the fraction M minus μ over s sub M")[$t = frac(M − μ, s_(M))$] where t is the value we compute for the significance test, M is the sample mean, μ is the hypothesized value of the population mean, and s#sub[M] is the estimated standard error of the mean. Notice the similarity of this formula to the formula for Z. In the previous example, we assumed that the scores were normally distributed. In this case, it is the population of difference scores that we assume to be normally distributed. The mean (M) of the N = 24 difference scores is 4.958, the hypothesized value of μ is 0, and the standard deviation (s) is 7.538. The estimate of the standard error of the mean is computed as: #math.equation(block: true, alt: "s sub M equals the fraction s over the square root of N equals the fraction 7.5382 over the square root of 24 equals 1.54")[$s_(M) = frac(s, sqrt(N)) = frac(7.5382, sqrt(24)) = 1.54$] Therefore, t = 4.96/1.54 = 3.22. The probability value for t depends on the degrees of freedom. The number of degrees of freedom is equal to N - 1 = 23. As shown below, the #link("https://onlinestatbook.com/2/calculators/t_dist.html")[t distribution calculator] finds that the probability of a t less than -3.22 or greater than 3.22 is only 0.0038. Therefore, if the drug had no effect, the probability of finding a difference between means as large or larger (in either direction) than the difference found is very low. Therefore the null hypothesis that the population mean difference score is zero can be rejected. The conclusion is that the population mean for the drug condition is higher than the population mean for the placebo condition. #figure(figph[t distribution calculator screenshot headed "t distribution with df = 23": a bell curve on an axis from -8 to 8 with df set to 23, t to 3.22, and Two-tailed test selected. The thin slivers beyond -3.22 and 3.22 are shaded and reported as Shaded area: 0.0038 — the p value for the ADHD delay-of-gratification difference scores.], alt: "t distribution calculator screenshot headed \"t distribution with df = 23\": a bell curve on an axis from -8 to 8 with df set to 23, t to 3.22, and Two-tailed test selected. The thin slivers beyond -3.22 and 3.22 are shaded and reported as Shaded area: 0.0038 — the p value for the ADHD delay-of-gratification difference scores.", caption: none) === #linebreak() Review of Assumptions + Each value is sampled independently from each other value. + The values are sampled from a normal distribution.