#set document(title: "9.1 Two Proportions", author: "Kathryn Kozak") #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")) == 9.1#h(0.6em)Two Proportions There are times you want to test a claim about two population proportions or construct a confidence interval estimate of the difference between two population proportions. As with all other hypothesis tests and confidence intervals, the process is the same though the formulas and assumptions are different. === Hypothesis Test for Two Populations Proportion (2-Prop Test) + State the random variables and the parameters in words. #linebreak() #math.equation(block: false, alt: "x sub 1")[$x_(1)$]= number of successes from group 1 #linebreak() #math.equation(block: false, alt: "x sub 2")[$x_(2)$] = number of successes from group 2 #linebreak() #math.equation(block: false, alt: "p sub 1")[$p_(1)$] = proportion of successes in group 1 #linebreak() #math.equation(block: false, alt: "p sub 2")[$p_(2)$] = proportion of successes in group 2 + State the null and alternative hypotheses and the level of significance #linebreak() #math.equation(block: false, alt: "H sub o : p sub 1 equals p sub 2 or H sub o : p sub 1 minus p sub 2 equals 0; H sub A : p sub 1 less than p sub 2 H sub A : p sub 1 minus p sub 2 less than 0; H sub A : p sub 1 greater than p sub 2 H sub A : p sub 1 minus p sub 2 greater than 0; H sub A : p sub 1 not equal to p sub 2 H sub A : p sub 1 minus p sub 2 not equal to 0")[$H_(o) : p_(1) = p_(2) " or " #h(1em) H_(o) : p_(1) − p_(2) = 0 \ H_(A) : p_(1) < p_(2) #h(1em) #h(1em) #h(0.222em) H_(A) : p_(1) − p_(2) < 0 \ H_(A) : p_(1) > p_(2) #h(1em) #h(1em) #h(0.222em) H_(A) : p_(1) − p_(2) > 0 \ H_(A) : p_(1) ≠ p_(2) #h(1em) #h(1em) #h(0.222em) H_(A) : p_(1) − p_(2) ≠ 0$] #linebreak() Also, state your #math.equation(block: false, alt: "α")[$α$] level here. + State and check the assumptions for a hypothesis test + A simple random sample of size #math.equation(block: false, alt: "n sub 1")[$n_(1)$] is taken from population 1, and a simple random sample of size #math.equation(block: false, alt: "n sub 2")[$n_(2)$] is taken from population 2. + The samples are independent. + The assumptions for the binomial distribution are satisfied for both populations. + To determine the sampling distribution of #math.equation(block: false, alt: "p ^ sub 1")[$hat(p)_(1)$], you need to show that #math.equation(block: false, alt: "n sub 1 p sub 1 greater than or equal to 5")[$n_(1) p_(1) ≥ 5$] and #math.equation(block: false, alt: "n sub 1 q sub 1 greater than or equal to 5")[$n_(1) q_(1) ≥ 5$], where #math.equation(block: false, alt: "q sub 1 equals 1 minus p sub 1")[$q_(1) = 1 − p_(1)$]. If this requirement is true, then the sampling distribution of #math.equation(block: false, alt: "p ^ sub 1")[$hat(p)_(1)$] is well approximated by a normal curve. To determine the sampling distribution of #math.equation(block: false, alt: "p ^ sub 2")[$hat(p)_(2)$], you need to show that #math.equation(block: false, alt: "n sub 2 p sub 2 greater than or equal to 5")[$n_(2) p_(2) ≥ 5$] and #math.equation(block: false, alt: "n sub 2 q sub 2 greater than or equal to 5")[$n_(2) q_(2) ≥ 5$], where #math.equation(block: false, alt: "q sub 2 equals 1 minus p sub 2")[$q_(2) = 1 − p_(2)$]. If this requirement is true, then the sampling distribution of #math.equation(block: false, alt: "p ^ sub 2")[$hat(p)_(2)$] is well approximated by a normal curve. However, you do not know #math.equation(block: false, alt: "p sub 1")[$p_(1)$] and #math.equation(block: false, alt: "p sub 2")[$p_(2)$], so you need to use #math.equation(block: false, alt: "p ^ sub 1")[$hat(p)_(1)$] and instead #math.equation(block: false, alt: "p ^ sub 2")[$hat(p)_(2)$]. This is not perfect, but it is the best you can do. Since #math.equation(block: false, alt: "n sub 1 p ^ sub 1 equals n sub 1 the fraction x sub 1 over n sub 1 equals x sub 1")[$n_(1) hat(p)_(1) = n_(1) frac(x_(1), n_(1)) = x_(1)$] (and similar for the other calculations) you just need to make sure that #math.equation(block: false, alt: "x sub 1")[$x_(1)$], #math.equation(block: false, alt: "n sub 1 minus x sub 1")[$n_(1) − x_(1)$], #math.equation(block: false, alt: "n sub 2 minus x sub 2")[$n_(2) − x_(2)$],and are all more than 5. + Find the sample statistics, test statistic, and p-value #linebreak() Sample Proportion: #linebreak() #math.equation(block: false, alt: "n sub 1 equals size of sample 1 n sub 2 equals size of sample 2; p ^ sub 1 equals the fraction x sub 1 over n sub 1 open parenthesis sample 1 proportion) p ^ sub 2 equals the fraction x sub 2 over n sub 2 (sample 2 proportion); q ^ sub 1 equals 1 minus p ^ sub 1 (complement of p ^ sub 1 close parenthesis q ^ sub 2 equals 1 minus p ^ sub 2 (complement of p ^ sub 2 close parenthesis")[$n_(1) = " size of sample " 1 n_(2) = " size of sample " 2 \ hat(p)_(1) = frac(x_(1), n_(1)) \( " sample " 1 " proportion) " hat(p)_(2) = frac(x_(2), n_(2)) " (sample " 2 " proportion) " \ hat(q)_(1) = 1 − hat(p)_(1) " (complement of " hat(p)_(1) \) hat(q)_(2) = 1 − hat(p)_(2) " (complement of " hat(p)_(2) \)$] #linebreak() Pooled Sample Proportion, #math.equation(block: false, alt: "p ―")[$limits(p)^(―)$]: #linebreak() #math.equation(block: false, alt: "p ― equals the fraction x sub 1 plus x sub 2 over n sub 1 plus n sub 2; q ― equals 1 minus p ―")[$limits(p)^(―) = frac(x_(1) + x_(2), n_(1) + n_(2)) \ limits(q)^(―) = 1 − limits(p)^(―)$] #linebreak() Test Statistic: #linebreak() #math.equation(block: false, alt: "z equals the fraction open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis minus open parenthesis p sub 1 minus p sub 2 close parenthesis over the square root of the fraction p ― q ― over n sub 1 plus the fraction p ― q ― over n sub 2")[$z = frac(( hat(p)_(1) − hat(p)_(2) ) − ( p_(1) − p_(2) ), sqrt(frac(limits(p)^(―) limits(q)^(―), n_(1)) + frac(limits(p)^(―) limits(q)^(―), n_(2))))$] #linebreak() Usually #math.equation(block: false, alt: "p sub 1 minus p sub 2 equals 0")[$p_(1) − p_(2) = 0$], since #math.equation(block: false, alt: "H sub o : p sub 1 equals p sub 2")[$H_(o) : p_(1) = p_(2)$] #linebreak() p-value: On TI-83/84: use normalcdf(lower limit, upper limit, 0, 1) On R: use pnorm(z, 0, 1) #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Note] If #math.equation(block: false, alt: "H sub A : p sub 1 less than p sub 2")[$H_(A) : p_(1) < p_(2)$] then lower limit is #math.equation(block: false, alt: "minus 1 E 99")[$− 1 E 99$] and upper limit is your test statistic. If #math.equation(block: false, alt: "H sub A : p sub 1 greater than p sub 2")[$H_(A) : p_(1) > p_(2)$], then lower limit is your test statistic and the upper limit is #math.equation(block: false, alt: "1 E 99")[$1 E 99$]. If #math.equation(block: false, alt: "H sub A : p sub 1 not equal to p sub 2")[$H_(A) : p_(1) ≠ p_(2)$], then find the p-value for #math.equation(block: false, alt: "H sub A : p sub 1 less than p sub 2")[$H_(A) : p_(1) < p_(2)$], and multiply by 2. ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Note] If #math.equation(block: false, alt: "H sub A : p sub 1 less than p sub 2")[$H_(A) : p_(1) < p_(2)$], then use pnorm(z, 0, 1). If #math.equation(block: false, alt: "H sub A : p sub 1 greater than p sub 2")[$H_(A) : p_(1) > p_(2)$], then use 1 - pnorm(z, 0, 1). If #math.equation(block: false, alt: "H sub A : p sub 1 not equal to p sub 2")[$H_(A) : p_(1) ≠ p_(2)$], then find the p-value for #math.equation(block: false, alt: "H sub A : p sub 1 less than p sub 2")[$H_(A) : p_(1) < p_(2)$], and multiply by 2. ] + Conclusion This is where you write reject #math.equation(block: false, alt: "H sub o")[$H_(o)$] or fail to reject #math.equation(block: false, alt: "H sub o")[$H_(o)$]. The rule is: if the p-value \< #math.equation(block: false, alt: "α")[$α$], then reject #math.equation(block: false, alt: "H sub o")[$H_(o)$]. If the p-value #math.equation(block: false, alt: "greater than or equal to α")[$≥ α$], then fail to reject #math.equation(block: false, alt: "H sub o")[$H_(o)$]. + Interpretation This is where you interpret in real world terms the conclusion to the test. The conclusion for a hypothesis test is that you either have enough evidence to show #math.equation(block: false, alt: "H sub A")[$H_(A)$] is true, or you do not have enough evidence to show #math.equation(block: false, alt: "H sub A")[$H_(A)$] is true. === Confidence Interval for the Difference Between Two Population Proportion (2-Prop Interval) The confidence interval for the difference in proportions has the same random variables and proportions and the same assumptions as the hypothesis test for two proportions. If you have already completed the hypothesis test, then you do not need to state them again. If you haven’t completed the hypothesis test, then state the random variables and proportions and state and check the assumptions before completing the confidence interval step + Find the sample statistics and the confidence interval #linebreak() Sample Proportion: #linebreak() #math.equation(block: false, alt: "n sub 1 equals size of sample 1 n sub 2 equals size of sample 2; p ^ sub 1 equals the fraction x sub 1 over n sub 1 open parenthesis sample 1 proportion) p ^ sub 2 equals the fraction x sub 2 over n sub 2 (sample 2 proportion); q ^ sub 1 equals 1 minus p ^ sub 1 open parenthesis complement of p ^ sub 1 close parenthesis q ^ sub 2 equals 1 minus p ^ sub 2 (complement of p ^ sub 2 close parenthesis")[$n_(1) = " size of sample " 1 n_(2) = " size of sample " 2 \ hat(p)_(1) = frac(x_(1), n_(1)) ( " sample " 1 " proportion) " hat(p)_(2) = frac(x_(2), n_(2)) " (sample " 2 " proportion) " \ hat(q)_(1) = 1 − hat(p)_(1) ( " complement of " hat(p)_(1) ) hat(q)_(2) = 1 − hat(p)_(2) " (complement of " hat(p)_(2) )$] #linebreak() Confidence Interval: #linebreak() The confidence interval estimate of the difference #math.equation(block: false, alt: "p sub 1 minus p sub 2")[$p_(1) − p_(2)$] is #linebreak() #math.equation(block: false, alt: "open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis minus E less than p sub 1 minus p sub 2 less than open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis plus E")[$( hat(p)_(1) − hat(p)_(2) ) − E < p_(1) − p_(2) < ( hat(p)_(1) − hat(p)_(2) ) + E$] #linebreak() where the margin of error E is given by #math.equation(block: false, alt: "E equals z sub c the square root of the fraction p ^ sub 1 q ^ sub 1 over n sub 1 plus the fraction p ^ sub 2 q ^ sub 2 over n sub 2")[$E = z_(c) sqrt(frac(hat(p)_(1) hat(q)_(1), n_(1)) + frac(hat(p)_(2) hat(q)_(2), n_(2)))$] #linebreak() #math.equation(block: false, alt: "z sub c")[$z_(c)$] = critical value + Statistical Interpretation: In general this looks like, “there is a C% chance that #math.equation(block: false, alt: "open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis minus E less than p sub 1 minus p sub 2 less than open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis plus E")[$( hat(p)_(1) − hat(p)_(2) ) − E < p_(1) − p_(2) < ( hat(p)_(1) − hat(p)_(2) ) + E$] contains the true difference in proportions.” + Real World Interpretation: This is where you state how much more (or less) the first proportion is from the second proportion. The critical value is a value from the normal distribution. Since a confidence interval is found by adding and subtracting a margin of error amount from the sample proportion, and the interval has a probability of being true, then you can think of this as the statement #math.equation(block: false, alt: "P open parenthesis open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis minus E less than p sub 1 minus p sub 2 less than open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis plus E close parenthesis equals C")[$P ( ( hat(p)_(1) − hat(p)_(2) ) − E < p_(1) − p_(2) < ( hat(p)_(1) − hat(p)_(2) ) + E ) = C$]. So you can use the invNorm command on the TI-83/84 calculator or qnorm on R to find the critical value. These are always the same value, so it is easier to just look at the table A.1 in the Appendix. #examplebox("Example 1")[hypothesis test for two population proportions][ Do husbands cheat on their wives more than wives cheat on their husbands ("Statistics brain," 2013)? Suppose you take a group of 1000 randomly selected husbands and find that 231 had cheated on their wives. Suppose in a group of 1200 randomly selected wives, 176 cheated on their husbands. Do the data show that the proportion of husbands who cheat on their wives are more than the proportion of wives who cheat on their husbands. Test at the 5% level. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[2-PropZTest and 2-PropZInt, pre-configured] Both panels open pre-configured for this example — enter x₁ = 231, n₁ = 1000, x₂ = 176, n₂ = 1200 and run. - 2-PropZTest (right-tailed): z = 5.072, p-value ≈ 2×10⁻⁷ - 2-PropZInt at 95%: (0.05142, 0.11724) ] + State the random variables and the parameters in words. + State the null and alternative hypotheses and the level of significance. + State and check the assumptions for a hypothesis test. + Find the sample statistics, test statistic, and p-value. + Conclusion + Interpretation #solutionbox[ 1. #math.equation(block: false, alt: "x sub 1")[$x_(1)$] = number of husbands who cheat on his wife #math.equation(block: false, alt: "x sub 2")[$x_(2)$] = number of wives who cheat on her husband #math.equation(block: false, alt: "p sub 1")[$p_(1)$] = proportion of husbands who cheat on his wife #math.equation(block: false, alt: "p sub 2")[$p_(2)$] = proportion of wives who cheat on her husband 2. #math.equation(block: false, alt: "H sub o : p sub 1 equals p sub 2 or H sub o : p sub 1 minus p sub 2 equals 0; H sub A : p sub 1 greater than p sub 2 H sub A : p sub 1 minus p sub 2 greater than 0; a equals 0.05")[$H_(o) : p_(1) = p_(2) " or " #h(1em) H_(o) : p_(1) − p_(2) = 0 \ H_(A) : p_(1) > p_(2) #h(1em) #h(1em) #h(0.222em) H_(A) : p_(1) − p_(2) > 0 \ a = 0.05$] 3. + A simple random sample of 1000 responses about cheating from husbands is taken. This was stated in the problem. A simple random sample of 1200 responses about cheating from wives is taken. This was stated in the problem. + The samples are independent. This is true since the samples involved different genders. + The properties of the binomial distribution are satisfied in both populations. This is true since there are only two responses, there are a fixed number of trials, the probability of a success is the same, and the trials are independent. + The sampling distributions of #math.equation(block: false, alt: "p ^ sub 1")[$hat(p)_(1)$] and #math.equation(block: false, alt: "p ^ sub 2")[$hat(p)_(2)$] can be approximated with a normal distribution. #linebreak() #math.equation(block: false, alt: "x sub 1 equals 231 , n sub 1 minus x sub 1 equals 1000 minus 231 equals 769 , x sub 2 equals 176")[$x_(1) = 231 , n_(1) − x_(1) = 1000 − 231 = 769 , x_(2) = 176$], and #linebreak() #math.equation(block: false, alt: "n sub 2 minus x sub 2 equals 1200 minus 176 equals 1024")[$n_(2) − x_(2) = 1200 − 176 = 1024$] are all greater than or equal to 5. So both sampling distributions of #math.equation(block: false, alt: "p ^ sub 1")[$hat(p)_(1)$] and #math.equation(block: false, alt: "p ^ sub 2")[$hat(p)_(2)$] can be approximated with a normal distribution. 4. Sample Proportion: #math.equation(block: true, alt: "n sub 1 equals 1000 n sub 2 equals 1200; p ^ sub 1 equals the fraction 231 over 1000 equals 0.231 p ^ sub 2 equals the fraction 176 over 1200 approximately equals 0.1467; q ^ sub 1 equals 1 minus the fraction 231 over 1000 equals the fraction 769 over 1000 equals 0.769 q ^ sub 2 equals 1 minus the fraction 176 over 1200 equals the fraction 1024 over 1200 approximately equals 0.8533")[$n_(1) = 1000 n_(2) = 1200 \ hat(p)_(1) = frac(231, 1000) = 0.231 hat(p)_(2) = frac(176, 1200) ≈ 0.1467 \ hat(q)_(1) = 1 − frac(231, 1000) = frac(769, 1000) = 0.769 hat(q)_(2) = 1 − frac(176, 1200) = frac(1024, 1200) ≈ 0.8533$] Pooled Sample Proportion, #math.equation(block: false, alt: "p ―")[$limits(p)^(―)$]: #math.equation(block: true, alt: "p ― equals the fraction 231 plus 176 over 1000 plus 1200 equals the fraction 407 over 2200 equals 0.185; q ― equals 1 minus the fraction 407 over 2200 equals the fraction 1793 over 2200 equals 0.815")[$limits(p)^(―) = frac(231 + 176, 1000 + 1200) = frac(407, 2200) = 0.185 \ limits(q)^(―) = 1 − frac(407, 2200) = frac(1793, 2200) = 0.815$] Test Statistic: #math.equation(block: true, alt: "z equals the fraction open parenthesis 0.231 minus 0.1467 close parenthesis minus 0 over the square root of the fraction 0.185 * 0.815 over 1000 plus the fraction 0.185 * 0.815 over 1200")[$z = frac(( 0.231 − 0.1467 ) − 0, sqrt(frac(0.185 * 0.815, 1000) + frac(0.185 * 0.815, 1200)))$] #math.equation(block: true, alt: "equals 5.0704")[$= 5.0704$] p-value: On TI-83/84: normalcdf #math.equation(block: false, alt: "open parenthesis 5.0704 , 1 E 99 , 0 , 1 close parenthesis equals 1.988 times 10 to the power minus 7")[$( 5.0704 , 1 E 99 , 0 , 1 ) = 1.988 × 10^(− 7)$] On R: #math.equation(block: false, alt: "1 minus pnorm open parenthesis 5.0704 , 0 , 1 close parenthesis equals 1.988 times 10 to the power minus 7")[$1 − " pnorm " ( 5.0704 , 0 , 1 ) = 1.988 × 10^(− 7)$] pnorm(5.0704, 0, 1) #figure(figph[TI-84 calculator 2-PropZTest input screen showing x1=231, n1=1000, x2=176, n2=1200, and the alternative hypothesis p1\>p2 selected.], alt: "TI-84 calculator 2-PropZTest input screen showing x1=231, n1=1000, x2=176, n2=1200, and the alternative hypothesis p1>p2 selected.", caption: [Figure #math.equation(block: false, alt: "1")[$1$]: Setup for 2-PropZTest on TI-83/84 Calculator]) #figure(figph[TI-84 calculator screen showing a 2-PropZTest setup with alternative p1\>p2, p̂1=0.231, p̂2=0.1466666667, pooled p̂=0.185, n1=1000, and n2=1200.], alt: "TI-84 calculator screen showing a 2-PropZTest setup with alternative p1>p2, p̂1=0.231, p̂2=0.1466666667, pooled p̂=0.185, n1=1000, and n2=1200.", caption: [Figure #math.equation(block: false, alt: "2")[$2$]: Results for 2-PropZTest on TI-83/84 Calculator]) #figure(figph[TI-84 calculator screen showing a 2-PropZTest with alternative hypothesis p1\>p2, z=5.072404516, P=1.9674319E-7, p̂1=0.231, p̂2=0.1466666667, and pooled proportion 0.185.], alt: "TI-84 calculator screen showing a 2-PropZTest with alternative hypothesis p1>p2, z=5.072404516, P=1.9674319E-7, p̂1=0.231, p̂2=0.1466666667, and pooled proportion 0.185.", caption: [Figure #math.equation(block: false, alt: "3")[$3$]: Results for 2-PropZTest on TI-83/84: Calculator]) On R: prop.test#math.equation(block: false, alt: "open parenthesis c open parenthesis x sub 1 , x sub 2 close parenthesis , c open parenthesis n sub 1 , n sub 2 close parenthesis , alternative equals")[$\( c \( x_(1) , x_(2) \) , c \( n_(1) , n_(2) \) , " alternative " =$] "less" or "greater". For this example, prop.test(c(231,176), c(1000, 1200), alternative="greater") prop.test(c(231, 176), c(1000, 1200), alternative="greater") 2-sample test for equality of proportions with continuity correction data: c(231, 176) out of c(1000, 1200) X-squared = 25.173, df = 1, p-value = 2.621e-07 alternative hypothesis: greater 95 percent confidence interval: 0.05579805 1.00000000 sample estimates: prop 1 prop 2 0.2310000 0.1466667 #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Note] The answer from R is the p-value. It is different from the formula or the TI-83/84 calculator due to a continuity correction that R does. ] 5. Conclusion Reject #math.equation(block: false, alt: "H sub o")[$H_(o)$], since the p-value is less than 5%. 6. Interpretation This is enough evidence to show that the proportion of husbands having affairs is more than the proportion of wives having affairs. ] ] #examplebox("Example 2")[confidence interval for two population properties][ Do more husbands cheat on their wives more than wives cheat on the husbands ("Statistics brain," 2013)? Suppose you take a group of 1000 randomly selected husbands and find that 231 had cheated on their wives. Suppose in a group of 1200 randomly selected wives, 176 cheated on their husbands. Estimate the difference in the proportion of husbands and wives who cheat on their spouses using a 95% confidence level. + State the random variables and the parameters in words. + State and check the assumptions for the confidence interval. + Find the sample statistics and the confidence interval. + Statistical Interpretation + Real World Interpretation #solutionbox[ 1. These were stated in Example #math.equation(block: false, alt: "1")[$1$], but are reproduced here for reference. #math.equation(block: false, alt: "x sub 1")[$x_(1)$] = number of husbands who cheat on his wife #math.equation(block: false, alt: "x sub 2")[$x_(2)$] = number of wives who cheat on her husband #math.equation(block: false, alt: "p sub 1")[$p_(1)$] = proportion of husbands who cheat on his wife #math.equation(block: false, alt: "p sub 2")[$p_(2)$] = proportion of wives who cheat on her husband 2. The assumptions were stated and checked in Example #math.equation(block: false, alt: "1")[$1$]. 3. Sample Proportion: #math.equation(block: true, alt: "n sub 1 equals 1000 n sub 2 equals 1200; p ^ sub 1 equals the fraction 231 over 1000 equals 0.231 p ^ sub 2 equals the fraction 176 over 1200 approximately equals 0.1467; q ^ sub 1 equals 1 minus the fraction 231 over 1000 equals the fraction 769 over 1000 equals 0.769 q ^ sub 2 equals 1 minus the fraction 176 over 1200 equals the fraction 1024 over 1200 approximately equals 0.8533")[$n_(1) = 1000 n_(2) = 1200 \ hat(p)_(1) = frac(231, 1000) = 0.231 hat(p)_(2) = frac(176, 1200) ≈ 0.1467 \ hat(q)_(1) = 1 − frac(231, 1000) = frac(769, 1000) = 0.769 hat(q)_(2) = 1 − frac(176, 1200) = frac(1024, 1200) ≈ 0.8533$] Confidence Interval: #math.equation(block: true, alt: "z sub c equals 1.96; E equals 1.96 the square root of the fraction 0.231 * 0.769 over 1000 plus the fraction 0.1467 * 0.8533 over 1200 equals 0.033")[$z_(c) = 1.96 \ E = 1.96 sqrt(frac(0.231 * 0.769, 1000) + frac(0.1467 * 0.8533, 1200)) = 0.033$] The confidence interval estimate of the difference #math.equation(block: false, alt: "p sub 1 minus p sub 2")[$p_(1) − p_(2)$] is #math.equation(block: true, alt: "open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis minus E less than p sub 1 minus p sub 2 less than open parenthesis p ^ sub 1 minus p ^ sub 2 close parenthesis plus E; open parenthesis 0.231 minus 0.1467 close parenthesis minus 0.033 less than p sub 1 minus p sub 2 less than open parenthesis 0.231 minus 0.1467 close parenthesis plus 0.033; 0.0513 less than p sub 1 minus p sub 2 less than 0.1173")[$( hat(p)_(1) − hat(p)_(2) ) − E < p_(1) − p_(2) < ( hat(p)_(1) − hat(p)_(2) ) + E \ ( 0.231 − 0.1467 ) − 0.033 < p_(1) − p_(2) < ( 0.231 − 0.1467 ) + 0.033 \ 0.0513 < p_(1) − p_(2) < 0.1173$] #figure(figph[TI-84 calculator 2-PropZInt input screen showing x1=231, n1=1000, x2=176, n2=1200, and confidence level .95.], alt: "TI-84 calculator 2-PropZInt input screen showing x1=231, n1=1000, x2=176, n2=1200, and confidence level .95.", caption: [Figure 9.1.4: Setup for 2-PropZInt on TI-83/84 Calculator]) #figure(figph[TI-84 calculator screen showing a two-proportion z-interval of (0.05142, 0.11724) with p̂1=0.231, p̂2=0.1466666667, n1=1000, and n2=1200.], alt: "TI-84 calculator screen showing a two-proportion z-interval of (0.05142, 0.11724) with p̂1=0.231, p̂2=0.1466666667, n1=1000, and n2=1200.", caption: [Figure #math.equation(block: false, alt: "5")[$5$]: Results for 2-PropZInt on TI-83/84 Calculator]) On R: prop.test#math.equation(block: false, alt: "open parenthesis c open parenthesis x sub 1 , x sub 2 close parenthesis , c open parenthesis n sub 1 , n sub 2 close parenthesis , conf.level equals C close parenthesis")[$( c ( x_(1) , x_(2) ) , c ( n_(1) , n_(2) ) , " conf.level " = C )$], where C is in decimal form. For this example, prop.test(c(231,176), c(1000, 1200), conf.level=0.95) prop.test(c(231, 176), c(1000, 1200), conf.level=0.95) 2-sample test for equality of proportions with continuity correction data: c(231, 176) out of c(1000, 1200) X-squared = 25.173, df = 1, p-value = 5.241e-07 alternative hypothesis: two.sided 95 percent confidence interval: 0.05050705 0.11815962 sample estimates: prop 1 prop 2 0.2310000 0.1466667 #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Note] The answer from R is the confidence interval. It is different from the formula or the TI-83/84 calculator due to a continuity correction that R does. ] 4. Statistical Interpretation: There is a 95% chance that #math.equation(block: false, alt: "0.0505 less than p sub 1 minus p sub 2 less than 0.1182")[$0.0505 < p_(1) − p_(2) < 0.1182$] contains the true difference in proportions. 5. Real World Interpretation: The proportion of husbands who cheat is anywhere from 5.05% to 11.82% higher than the proportion of wives who cheat. ] ] === Homework #notebox("Your Turn", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ In each problem show all steps of the hypothesis test or confidence interval. If some of the assumptions are not met, note that the results of the test or interval may not be correct and then continue the process of the hypothesis test or confidence interval. + Many high school students take the AP tests in different subject areas. In 2007, of the 144,796 students who took the biology exam 84,199 of them were female. In that same year, of the 211,693 students who took the calculus AB exam 102,598 of them were female ("AP exam scores," 2013). Is there enough evidence to show that the proportion of female students taking the biology exam is higher than the proportion of female students taking the calculus AB exam? Test at the 5% level. + Many high school students take the AP tests in different subject areas. In 2007, of the 144,796 students who took the biology exam 84,199 of them were female. In that same year, of the 211,693 students who took the calculus AB exam 102,598 of them were female ("AP exam scores," 2013). Estimate the difference in the proportion of female students taking the biology exam and female students taking the calculus AB exam using a 90% confidence level. + Many high school students take the AP tests in different subject areas. In 2007, of the 211,693 students who took the calculus AB exam 102,598 of them were female and 109,095 of them were male ("AP exam scores," 2013). Is there enough evidence to show that the proportion of female students taking the calculus AB exam is different from the proportion of male students taking the calculus AB exam? Test at the 5% level. + Many high school students take the AP tests in different subject areas. In 2007, of the 211,693 students who took the calculus AB exam 102,598 of them were female and 109,095 of them were male ("AP exam scores," 2013). Estimate using a 90% level the difference in proportion of female students taking the calculus AB exam versus male students taking the calculus AB exam. + Are there more children diagnosed with Autism Spectrum Disorder (ASD) in states that have larger urban areas over states that are mostly rural? In the state of Pennsylvania, a fairly urban state, there are 245 eight year olds diagnosed with ASD out of 18,440 eight year olds evaluated. In the state of Utah, a fairly rural state, there are 45 eight year olds diagnosed with ASD out of 2,123 eight year olds evaluated ("Autism and developmental," 2008). Is there enough evidence to show that the proportion of children diagnosed with ASD in Pennsylvania is more than the proportion in Utah? Test at the 1% level. + Are there more children diagnosed with Autism Spectrum Disorder (ASD) in states that have larger urban areas over states that are mostly rural? In the state of Pennsylvania, a fairly urban state, there are 245 eight year olds diagnosed with ASD out of 18,440 eight year olds evaluated. In the state of Utah, a fairly rural state, there are 45 eight year olds diagnosed with ASD out of 2,123 eight year olds evaluated ("Autism and developmental," 2008). Estimate the difference in proportion of children diagnosed with ASD between Pennsylvania and Utah. Use a 98% confidence level. + A child dying from an accidental poisoning is a terrible incident. Is it more likely that a male child will get into poison than a female child? To find this out, data was collected that showed that out of 1830 children between the ages one and four who pass away from poisoning, 1031 were males and 799 were females (Flanagan, Rooney & Griffiths, 2005). Do the data show that there are more male children dying of poisoning than female children? Test at the 1% level. + A child dying from an accidental poisoning is a terrible incident. Is it more likely that a male child will get into poison than a female child? To find this out, data was collected that showed that out of 1830 children between the ages one and four who pass away from poisoning, 1031 were males and 799 were females (Flanagan, Rooney & Griffiths, 2005). Compute a 99% confidence interval for the difference in proportions of poisoning deaths of male and female children ages one to four. Answer For all hypothesis tests, just the conclusion is given. For all confidence intervals, just the interval using technology (Software R) is given. See solution for the entire answer. + Reject Ho + #math.equation(block: false, alt: "0.0941 less than p sub 1 minus p sub 2 less than 0.0996")[$0.0941 < p_(1) − p_(2) < 0.0996$] + Reject Ho + #math.equation(block: false, alt: "minus 0.0332 less than p sub 1 minus p sub 2 less than minus 0.0282")[$− 0.0332 < p_(1) − p_(2) < − 0.0282$] + Fail to reject Ho + #math.equation(block: false, alt: "minus 0.01547 less than p sub 1 minus p sub 2 less than minus 0.0001")[$− 0.01547 < p_(1) − p_(2) < − 0.0001$] + Reject Ho + #math.equation(block: false, alt: "0.0840 less than p sub 1 minus p sub 2 less than 0.1696")[$0.0840 < p_(1) − p_(2) < 0.1696$] ]