#set document(title: "13.2 Example Calculations", 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")) == 13.2#h(0.6em)Example Calculations #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Prerequisites] Introduction to Power, Binomial Distribution, Testing a Single Mean #linebreak() #linebreak() ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Learning Objectives] + Compute power using the binomial distribution + Compute power using the normal distribution + Use a power calculator to compute power for the t distribution ] In the "#link("https://onlinestatbook.com/2/case_studies/bond.html")[Shaking and Stirring Martinis]" case study, the question was whether Mr. Bond could tell the difference between martinis that were stirred and martinis that were shaken. For the sake of this example, assume he can tell the difference and is able to correctly state whether a martini had been shaken or stirred 0.75 of the time. Now, suppose an experiment is being conducted to investigate whether Mr. Bond can tell the difference. Specifically, is Mr. Bond correct more than 0.50 of the time? We know that he is (that's an assumption of the example). However, the experimenter does not know and asks Mr. Bond to judge 16 martinis. The experimenter will do a significance test based on the binomial distribution. Specifically, if a one tailed test is significant at the 0.05 level, then he or she will conclude that Mr. Bond can tell the difference. The probability value is computed assuming the null hypothesis is true (π = 0.50). Therefore, the experimenter will determine how many times Mr. Bond is correct, and compute the probability of being correct that many or more times given that the null hypothesis is true. The question is: what is the probability the experimenter will correctly reject the null hypothesis that π = 0.50? In other words, what is the power of this experiment? The binomial distribution for N = 16 and π = 0.50 is shown in Figure 1. The probability of being correct on 11 or more trials is 0.105 and the probability of being correct on 12 or more trials is 0.038. Therefore, the probability of being correct on 12 or more trials is less than 0.05. This means that the null hypothesis will be rejected if Mr. Bond is correct on 12 or more trials and will not be rejected otherwise. Binomial Calculator #figure(figph[Binomial distribution for N = 16 and π = 0.50, the null-hypothesis distribution in the James Bond power example: probability bars against number correct 0 to 16 on a y-axis 0 to 0.25, peaking at 0.196 at 8. The bars for 12 or more correct — the rejection region, probability 0.038 — are red; the rest are blue.], alt: "Binomial distribution for N = 16 and π = 0.50, the null-hypothesis distribution in the James Bond power example: probability bars against number correct 0 to 16 on a y-axis 0 to 0.25, peaking at 0.196 at 8. The bars for 12 or more correct — the rejection region, probability 0.038 — are red; the rest are blue.", caption: [Figure 1. The binomial distribution for N = 16 and π = 0.50.]) We know that Mr. Bond is correct 0.75 of the time. (Obviously the experimenter does not know this or there would be no need for an experiment.) The binomial distribution with N = 16 and π = 0.75 is shown in Figure 2. #figure(figph[Binomial distribution for N = 16 and π = 0.75, Mr. Bond's true ability: the same axes, now skewed left with the peak of about 0.225 at 12 correct. The bars from 12 through 16 are red and sum to 0.63, the power of the experiment; the blue bars from 6 through 11 are the outcomes that would fail to reject.], alt: "Binomial distribution for N = 16 and π = 0.75, Mr. Bond's true ability: the same axes, now skewed left with the peak of about 0.225 at 12 correct. The bars from 12 through 16 are red and sum to 0.63, the power of the experiment; the blue bars from 6 through 11 are the outcomes that would fail to reject.", caption: [Figure 2. The binomial distribution for N = 16 and π = 0.75.]) The probability of being correct on 12 or more trials is 0.63. Therefore, the power of the experiment is 0.63. To sum up, the probability of being correct on 12 or more trials given that the null hypothesis is true is less than 0.05. Therefore, if Mr. Bond is correct on 12 or more trials, the null hypothesis will be rejected. Given Mr. Bond's true ability to be correct on 0.75 of the trials, the probability he will be correct on 12 or more trials is 0.63. Therefore power is 0.63. In the section on Testing a Single Mean for significance, the first example was based on the assumption that the experimenter knew the population variance. Although this is rarely true in practice, the example is very useful for pedagogical purposes. For the same reason, the following example assumes the experimenter knows the population variance. #link("http://members.aol.com/johnp71/javastat.html#Power")[Power calculators] are available for situations in which the experimenter does not know the population variance. Suppose a math achievement test were known to have a mean of 75 and a standard deviation of 10. A researcher is interested in whether a new method of teaching results in a higher mean. Assume that although the experimenter does not know it, the population mean for the new method is 80. The researcher plans to sample 25 subjects and do a one-tailed test of whether the sample mean is significantly higher than 75. What is the probability that the researcher will correctly reject the false null hypothesis that the population mean for the new method is 75 or lower? The following shows how this probability is computed. The researcher assumes that the population standard deviation with the new method is the same as with the old method (10) and that the distribution is normal. Since the population standard deviation is assumed to be known, the researcher can use the normal distribution rather than the t distribution to compute the p value. Recall that the standard error of the mean (σ#sub[M]) is #math.equation(block: true, alt: "σ sub M equals the fraction σ over the square root of N")[$σ_(M) = frac(σ, sqrt(N))$] which is equal to 10/5 = 2 in this example. As can be seen in Figure 3, if the null hypothesis that the population mean equals 75 is true, then the probability of a sample mean being greater than or equal to 78.29 is 0.05. Therefore, the experimenter will reject the null hypothesis if the sample mean, M, is 78.29 or larger. #figure(figph[Normal distribution calculator screenshot for the null hypothesis: Mean 75, Sd 2, Shaded Area 0.05 selected Above, on an axis labeled 67 to 83. The upper tail beyond 78.2897 is shaded blue and the calculator reports Above: 78.2897 — the sample mean at which the test becomes significant.], alt: "Normal distribution calculator screenshot for the null hypothesis: Mean 75, Sd 2, Shaded Area 0.05 selected Above, on an axis labeled 67 to 83. The upper tail beyond 78.2897 is shaded blue and the calculator reports Above: 78.2897 — the sample mean at which the test becomes significant.", caption: [Figure 3. The sampling distribution of the mean if the null hypothesis is true. (Figure created with the Inverse Normal Calculator)]) The question, then, is what is the probability the experimenter gets a sample mean greater than 78.29 given that the population mean is 80? Figure 4 shows that this probability is 0.80. #figure(figph[Normal distribution calculator screenshot for the true state of affairs: Mean 80, Sd 2, on an axis labeled 72 to 88, with everything Above 78.29 shaded blue. The calculator reports Shaded area: 0.803724 — the power of the test, most of the distribution.], alt: "Normal distribution calculator screenshot for the true state of affairs: Mean 80, Sd 2, on an axis labeled 72 to 88, with everything Above 78.29 shaded blue. The calculator reports Shaded area: 0.803724 — the power of the test, most of the distribution.", caption: [Figure 4. The sampling distribution of the mean if the population mean is 80. The test is significant if the sample mean is 78.29 or higher. (Figure created with the Normal Calculator)]) Therefore, the probability that the experimenter will reject the null hypothesis that the population mean of the new method is 75 is 0.80. In other words, power = 0.80. Calculation of power is more complex for t tests and for Analysis of Variance. The #link("https://onlinestatbook.com/2/calculators/power_calc.html")[power calculator] computes power for a t test of independent groups. Calculators for other types of designs are linked to below. #link("http://www.stat.uiowa.edu/~rlenth/Power/index.html")[Russ Lenth's Power Calculators]