#set document(title: "13.5 Mann-Whitney U Test", author: "Rachel Webb") #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.5#h(0.6em)Mann-Whitney U Test The Mann-Whitney U Test is the non-parametric alternative to the independent t-test. The test was expanded on Frank Wilcoxon’s Rank Sum test by Henry Mann and Donald Whitney. #figure(figph[Black and white portrait photograph of Henry Mann.], alt: "Black and white portrait photograph of Henry Mann.", caption: [#link("https://math.osu.edu/about-us/history/henry-berthold-mann")[Henry Mann]]) The independent t-test assumes the populations are normally distributed. When these conditions are not met, the Mann-Whitney Test is an alternative method. If two groups come from the same distribution and were randomly assigned labels, then the two different groups should have values somewhat equally distributed between the two groups. The Mann-Whitney Test looks at all the possible rankings between the data points. For large sample sizes, a normal approximation of the distribution of ranks is used. === Small Sample Size Case #math.equation(block: false, alt: "open parenthesis n less than or equal to 20 close parenthesis")[$( n ≤ 20 )$] Combine the data from both groups and sort from smallest to largest. Make sure to label the data values so you know which group they came from. Rank the data. Sum the ranks separately from each group. Let #math.equation(block: false, alt: "R sub 1")[$R_(1)$] = sum of ranks for group one and #math.equation(block: false, alt: "R sub 2")[$R_(2)$] = sum of ranks for group two. Find the #math.equation(block: false, alt: "U")[$U$] statistic for both groups: #math.equation(block: false, alt: "U sub 1 equals R sub 1 minus the fraction n sub 1 open parenthesis n sub 1 plus 1 close parenthesis over 2 , U sub 2 equals R sub 2 minus the fraction n sub 2 open parenthesis n sub 2 plus 1 close parenthesis over 2")[$U_(1) = R_(1) − frac(n_(1) ( n_(1) + 1 ), 2) , U_(2) = R_(2) − frac(n_(2) ( n_(2) + 1 ), 2)$]. The test statistic #math.equation(block: false, alt: "U equals Min open parenthesis U sub 1 , U sub 2 close parenthesis")[$U = "Min" ( U_(1) , U_(2) )$] is the smaller of #math.equation(block: false, alt: "U sub 1")[$U_(1)$] or #math.equation(block: false, alt: "U sub 2")[$U_(2)$]. Critical values are found given in the tables in Figures 13-6 #math.equation(block: false, alt: "open parenthesis α equals 0.05 close parenthesis")[$( α = 0.05 )$] and 13-7 #math.equation(block: false, alt: "open parenthesis α equals 0.01 close parenthesis")[$( α = 0.01 )$]. #figure(table( columns: 20, align: left, inset: 6pt, [], [#math.equation(block: false, alt: "n sub 2")[$n_(2)$]], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [#math.equation(block: false, alt: "n sub 1")[$n_(1)$]], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [2], [-], [-], [-], [-], [-], [-], [0], [0], [0], [0], [1], [1], [1], [1], [1], [2], [2], [2], [2], [3], [-], [-], [-], [0], [1], [1], [2], [2], [3], [3], [4], [4], [5], [5], [6], [6], [7], [7], [8], [4], [-], [-], [0], [1], [2], [3], [4], [4], [5], [6], [7], [8], [9], [10], [11], [11], [12], [13], [13], [5], [-], [0], [1], [2], [3], [5], [6], [7], [8], [9], [11], [12], [13], [14], [15], [17], [18], [19], [20], [6], [-], [1], [2], [3], [5], [6], [8], [10], [11], [13], [14], [16], [17], [19], [21], [22], [24], [25], [27], [7], [-], [1], [3], [5], [6], [8], [10], [12], [14], [16], [18], [20], [22], [24], [26], [28], [30], [32], [34], [8], [0], [2], [4], [6], [8], [10], [13], [15], [17], [19], [22], [24], [26], [29], [31], [34], [36], [38], [41], [9], [0], [2], [4], [7], [10], [12], [15], [17], [21], [23], [26], [28], [31], [34], [37], [39], [42], [45], [48], [10], [0], [3], [5], [8], [11], [14], [17], [20], [23], [26], [29], [33], [36], [39], [42], [45], [48], [52], [55], [11], [0], [3], [6], [9], [13], [16], [19], [23], [26], [30], [33], [37], [40], [44], [47], [51], [55], [58], [62], [12], [1], [4], [7], [11], [14], [18], [22], [26], [29], [33], [37], [41], [45], [49], [53], [57], [61], [65], [69], [13], [1], [4], [8], [12], [16], [20], [24], [28], [33], [37], [41], [45], [50], [54], [59], [63], [67], [72], [76], [14], [1], [5], [9], [13], [17], [22], [26], [31], [36], [40], [45], [50], [55], [59], [64], [67], [74], [78], [83], [15], [1], [5], [10], [14], [19], [24], [29], [34], [39], [44], [49], [54], [59], [64], [70], [75], [80], [85], [90], [16], [1], [6], [11], [15], [21], [26], [31], [37], [42], [47], [53], [59], [64], [70], [75], [81], [86], [92], [98], [17], [2], [6], [11], [17], [22], [28], [34], [39], [45], [51], [57], [63], [67], [75], [81], [87], [93], [99], [105], [18], [2], [7], [12], [18], [24], [30], [36], [42], [48], [55], [61], [67], [74], [80], [86], [93], [99], [106], [112], [19], [2], [7], [13], [19], [25], [32], [38], [45], [52], [58], [65], [72], [78], [85], [92], [99], [106], [113], [119], [20], [2], [8], [14], [20], [27], [34], [41], [48], [55], [62], [69], [76], [83], [90], [98], [105], [112], [119], [127], )) #figure(table( columns: 20, align: left, inset: 6pt, [], [#math.equation(block: false, alt: "n sub 2")[$n_(2)$]], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [#math.equation(block: false, alt: "n sub 1")[$n_(1)$]], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [2], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [-], [0], [0], [3], [-], [-], [-], [-], [-], [-], [-], [0], [0], [0], [1], [1], [1], [2], [2], [2], [2], [3], [3], [4], [-], [-], [-], [-], [0], [0], [1], [1], [2], [2], [3], [3], [4], [5], [5], [6], [6], [7], [8], [5], [-], [-], [-], [0], [1], [1], [2], [3], [4], [5], [6], [7], [7], [8], [9], [10], [11], [12], [13], [6], [-], [-], [0], [1], [2], [3], [4], [5], [6], [7], [9], [10], [11], [12], [13], [15], [16], [17], [18], [7], [-], [-], [0], [1], [3], [4], [6], [7], [9], [10], [12], [13], [15], [16], [18], [19], [21], [22], [24], [8], [-], [-], [1], [2], [4], [6], [7], [9], [11], [13], [15], [17], [18], [20], [22], [24], [26], [28], [30], [9], [-], [0], [1], [3], [5], [7], [9], [11], [13], [16], [18], [20], [22], [24], [27], [29], [31], [33], [36], [10], [-], [0], [2], [4], [6], [9], [11], [13], [16], [18], [21], [24], [26], [29], [31], [34], [37], [39], [42], [11], [-], [0], [2], [5], [7], [10], [13], [16], [18], [21], [24], [27], [30], [33], [36], [39], [42], [45], [46], [12], [-], [1], [3], [6], [9], [12], [15], [18], [21], [24], [27], [31], [34], [37], [41], [44], [47], [51], [54], [13], [-], [1], [3], [7], [10], [13], [17], [20], [24], [27], [31], [34], [38], [42], [45], [49], [53], [56], [60], [14], [-], [1], [4], [7], [11], [15], [18], [22], [26], [30], [34], [38], [42], [46], [50], [54], [58], [63], [67], [15], [-], [2], [5], [8], [12], [16], [20], [24], [29], [33], [37], [42], [46], [51], [55], [60], [64], [69], [73], [16], [-], [2], [5], [9], [13], [18], [22], [27], [31], [36], [41], [45], [50], [55], [60], [65], [70], [74], [79], [17], [-], [2], [6], [10], [15], [19], [24], [29], [34], [39], [44], [49], [54], [60], [65], [70], [75], [81], [86], [18], [-], [2], [6], [11], [16], [21], [26], [31], [37], [42], [47], [53], [58], [64], [70], [75], [81], [87], [92], [19], [0], [3], [7], [12], [17], [22], [28], [33], [39], [45], [51], [56], [63], [69], [74], [81], [87], [93], [99], [20], [0], [3], [8], [13], [18], [24], [30], [36], [42], [46], [54], [60], [67], [73], [79], [86], [92], [99], [105], )) If #math.equation(block: false, alt: "U")[$U$] is less than or equal to the critical value, then reject #math.equation(block: false, alt: "H sub 0")[$H_(0)$]. Dashes indicate that the sample is too small to reject #math.equation(block: false, alt: "H sub 0")[$H_(0)$]. If you have only sample size above 20, use the following online calculator to find the critical value: #link("https://www.socscistatistics.com/tests/mannwhitney/default.aspx")[https://www.socscistatistics.com/tests/mannwhitney/default.aspx]. #examplebox("Example 1")[][ Student employees are a major part of most college campus employment. Two major departments that participate in student hiring are listed below with the number of hours worked by students for a month. At the 0.05 level of significance, is there sufficient evidence to conclude a difference in hours between the two departments? #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[See the two groups before you rank them] Athletics is preloaded in L1 and Library in L2. Draw side-by-side boxplots, then run 1-Var Stats on each list: the medians sit close together and the boxes overlap heavily - the shared location the U test ends up failing to reject. Crunch has no Mann-Whitney panel yet, so the ranking and U = 30 are still yours to do. - Boxplots: Athletics in L1, Library in L2 - 1-Var Stats on the same two lists ] Athletics 20 24 17 12 18 22 25 30 15 19   Library 35 28 24 20 25 18 22 26 31 21 19 #solutionbox[ The hypotheses are: #math.equation(block: false, alt: "H sub 0")[$H_(0)$]: There is no difference in the number of hours student employees work for the athletics department and the library. #linebreak() #math.equation(block: false, alt: "H sub 1")[$H_(1)$]: There is a difference in the number of hours student employees work for the athletics department and the library. Since the sample sizes are small and the distributions are not assumed to be normally distributed, the t-test for independent groups should not be used. Instead, we will use the nonparametric Mann-Whitney Test. To start, combine the groups, sort the data from smallest to largest, and note which group the data point is from. Rank the data and look for the ties. Figure 13-10 shows the ranks for the combined data. \# Figure 13-10 by machine: combined midranks, then the U statistics ath \<- c(20, 24, 17, 12, 18, 22, 25, 30, 15, 19) \# n1 = 10 lib \<- c(35, 28, 24, 20, 25, 18, 22, 26, 31, 21, 19) \# n2 = 11 r \<- rank(c(ath, lib)) \# ties averaged: the 18s -\> 4.5, the 19s -\> 6.5 R1 \<- sum(r\[1:10\]); R2 \<- sum(r\[11:21\]) \# 85 and 146 U1 \<- R1 - 10 \* 11 / 2; U2 \<- R2 - 11 \* 12 / 2 \# 30 and 80 U \<- min(U1, U2) \# test statistic U = 30 \# Why U = 30 is unremarkable: if the labels really are arbitrary, reshuffling \# which 10 of the 21 students are "Athletics" should reproduce U this small often. set.seed(13) sim \<- replicate(10000, { g \<- sample(21, 10) min(sum(r\[g\]) - 55, sum(r\[-g\]) - 66) }) mean(sim \<= U) \# ~0.08, above 0.05 -\> do not reject, agreeing with CV = 26 hist(sim, breaks = 20, main = "U from 10000 random label shuffles", xlab = "U") abline(v = U, lwd = 2) \# the observed U = 30 sits inside the bulk, not the tail abline(v = 26, lty = 2) \# the book's critical value from Figure 13-8 #figure(table( columns: 4, align: left, inset: 6pt, table.header([Student], [Department], [Hours], [Rank]), [1], [Athletics], [12], [1], [2], [Athletics], [15], [2], [3], [Athletics], [17], [3], [4], [Athletics], [18], [4.5], [5], [Library], [18], [4.5], [6], [Athletics], [19], [6.5], [7], [Library], [19], [6.5], [8], [Athletics], [20], [8.5], [9], [Library], [20], [8.5], [10], [Library], [21], [10], [11], [Athletics], [22], [11.5], [12], [Library], [22], [11.5], [13], [Athletics], [24], [13.5], [14], [Library], [24], [13.5], [15], [Athletics], [25], [15.5], [16], [Library], [25], [15.5], [17], [Library], [26], [17], [18], [Library], [28], [18], [19], [Athletics], [30], [19], [20], [Library], [31], [20], [21], [Library], [35], [21], )) Sum the ranks for each group: #math.equation(block: true, alt: "R sub 1 equals 1 plus 2 plus 3 plus 4.5 plus 6.5 plus 8.5 plus 11.5 plus 13.5 plus 15.5 plus 19 equals 85")[$R_(1) = 1 + 2 + 3 + 4.5 + 6.5 + 8.5 + 11.5 + 13.5 + 15.5 + 19 = 85$] #math.equation(block: true, alt: "R sub 2 equals 4.5 plus 6.5 plus 8.5 plus 10 plus 11.5 plus 13.5 plus 15.5 plus 17 plus 18 plus 20 plus 21 equals 146")[$R_(2) = 4.5 + 6.5 + 8.5 + 10 + 11.5 + 13.5 + 15.5 + 17 + 18 + 20 + 21 = 146$] Compute the test statistic: #math.equation(block: true, alt: "U sub 1 equals R sub 1 minus the fraction n sub 1 open parenthesis n sub 1 plus 1 close parenthesis over 2 equals 85 minus the fraction 10 times 11 over 2 equals 30")[$U_(1) = R_(1) − frac(n_(1) ( n_(1) + 1 ), 2) = 85 − frac(10 · 11, 2) = 30$] #math.equation(block: true, alt: "U sub 2 equals R sub 2 minus the fraction n sub 2 open parenthesis n sub 2 plus 1 close parenthesis over 2 equals 146 minus the fraction 11 times 12 over 2 equals 80")[$U_(2) = R_(2) − frac(n_(2) ( n_(2) + 1 ), 2) = 146 − frac(11 · 12, 2) = 80$] #math.equation(block: true, alt: "U equals 30")[$U = 30$] Find the critical value using Figure 13-8, where #math.equation(block: false, alt: "n sub 1 equals 10")[$n_(1) = 10$] and #math.equation(block: false, alt: "n sub 2 equals 11")[$n_(2) = 11$]. The critical value = 26. Do not reject #math.equation(block: false, alt: "H sub 0")[$H_(0)$], since #math.equation(block: false, alt: "U equals 30 greater than CV equals 26")[$U = 30 > "CV" = 26$]. There is not enough evidence to support the claim that there is a difference in the number of hours student employees work for the athletics department and the library. ] ] === Large Sample Size Case (#math.equation(block: false, alt: "n sub 1 greater than 20")[$n_(1) > 20$] and #math.equation(block: false, alt: "n sub 2 greater than 20")[$n_(2) > 20$]) Find the #math.equation(block: false, alt: "U")[$U$] statistic for both groups: #math.equation(block: false, alt: "U sub 1 equals R sub 1 minus the fraction n sub 1 open parenthesis n sub 1 plus 1 close parenthesis over 2")[$U_(1) = R_(1) − frac(n_(1) ( n_(1) + 1 ), 2)$], #math.equation(block: false, alt: "U sub 2 equals R sub 2 minus the fraction n sub 2 open parenthesis n sub 2 plus 1 close parenthesis over 2")[$U_(2) = R_(2) − frac(n_(2) ( n_(2) + 1 ), 2)$]. Let #math.equation(block: false, alt: "U equals Min open parenthesis U sub 1 , U sub 2 close parenthesis")[$U = "Min" ( U_(1) , U_(2) )$], the smaller of #math.equation(block: false, alt: "U sub 1")[$U_(1)$] or #math.equation(block: false, alt: "U sub 2")[$U_(2)$]. The formula for the test statistic is: #math.equation(block: true, alt: "z equals the fraction open parenthesis U minus open parenthesis the fraction n sub 1 times n sub 2 over 2 close parenthesis close parenthesis over the square root of the fraction n sub 1 times n sub 2 open parenthesis n sub 1 plus n sub 2 plus 1 close parenthesis over 12")[$z = frac(( U − ( frac(n_(1) · n_(2), 2) ) ), sqrt(frac(n_(1) · n_(2) ( n_(1) + n_(2) + 1 ), 12)))$] #examplebox("Example 2")[][ A manager believes that the sales of coffee at their Portland store is more than the sales at their Cannon Beach store. They take a random sample of weekly sales from the two stores over the last year. Use the Mann-Whitney test to see if the manager’s claim could be true. Use the p-value method with #math.equation(block: false, alt: "α equals 0.05")[$α = 0.05$]. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Two-tailed p-value for the large-sample U] With U = 190.5 the normal approximation gives z = -0.7429. The first link shades the tail below it: 0.2288, doubled is the book's p-value of 0.4575, far above alpha = 0.05. The second link is the critical-value route to the same decision, inverse normal at 0.025 for +/-1.96. Try area 0.05 instead and you get -1.645, which is why the tail area for a two-tailed alpha = 0.05 has to be 0.025. - P(Z \< -0.7429) = 0.2288 (doubled = 0.4575) - invNorm(0.025) = -1.96 ] Portland Cannon Beach 1510 1257   3585 1510 4125 4677   4399 5244 1510 3055   1764 1510 5244 1764   3853 4399 4125 6128   5244 1510 6128 3319   1510 5244 3319 6433   2533 4125 3319 5244   3585 2275 3055 6134   2533 2275 4025 3015   4399 3585       4125 5244\\ #solutionbox[ Always choose group 1 as the group with the smallest sample size: in this case, Portland. (If the sample sizes are equal, then whatever group comes first in the problem is group one.) If there are no ties at the end, the last rank should match the total of both sample sizes. Combine the data, keeping the group label, then rank the combined data. #figure(table( columns: 9, align: left, inset: 6pt, table.header([Order], [Store], [Sales], [Rank], [], [Order], [Store], [Sales], [Rank]), [1], [Portland], [1257], [1], [], [22], [Cannon Beach], [3585], [21], [2], [Portland], [1510], [4.5], [], [23], [Cannon Beach], [3853], [23], [3], [Portland], [1510], [4.5], [], [24], [Portland], [4025], [24], [4], [Cannon Beach], [1510], [4.5], [], [25], [Portland], [4125], [26.5], [5], [Cannon Beach], [1510], [4.5], [], [26], [Portland], [4125], [26.5], [6], [Cannon Beach], [1510], [4.5], [], [27], [Cannon Beach], [4125], [26.5], [7], [Cannon Beach], [1510], [4.5], [], [28], [Cannon Beach], [4125], [26.5], [8], [Portland], [1764], [8.5], [], [29], [Cannon Beach], [4399], [30], [9], [Cannon Beach], [1764], [8.5], [], [30], [Cannon Beach], [4399], [30], [10], [Cannon Beach], [2275], [10.5], [], [31], [Cannon Beach], [4399], [30], [11], [Cannon Beach], [2275], [10.5], [], [32], [Portland], [4677], [32], [12], [Cannon Beach], [2533], [12.5], [], [33], [Portland], [5244], [35.5], [13], [Cannon Beach], [2533], [12.5], [], [34], [Portland], [5244], [35.5], [14], [Portland], [3015], [14], [], [35], [Cannon Beach], [5244], [35.5], [15], [Portland], [3055], [15.5], [], [36], [Cannon Beach], [5244], [35.5], [16], [Portland], [3055], [15.5], [], [37], [Cannon Beach], [5244], [35.5], [17], [Portland], [3319], [18], [], [38], [Cannon Beach], [5244], [35.5], [18], [Portland], [3319], [18], [], [39], [Portland], [6128], [39.5], [19], [Portland], [3319], [18], [], [40], [Portland], [6128], [39.5], [20], [Cannon Beach], [3585], [21], [], [41], [Portland], [6134], [41], [21], [Cannon Beach], [3585], [21], [], [42], [Portland], [6433], [42], )) The hypotheses are: #math.equation(block: false, alt: "H sub 0")[$H_(0)$]: There is no difference in the coffee sales between the Portland and Cannon Beach stores. #linebreak() #math.equation(block: false, alt: "H sub 1")[$H_(1)$]: There is a difference in the coffee sales between the Portland and Cannon Beach stores. Sum the ranks for each group. The sum for the Portland store’s ranks: #math.equation(block: false, alt: "R sub 1 equals 459.5")[$R_(1) = 459.5$]. #linebreak() The sum for the Cannon Beach store’s ranks: #math.equation(block: false, alt: "R sub 2 equals 443.5")[$R_(2) = 443.5$]. Compute the test statistic: #math.equation(block: true, alt: "U sub 1 equals R sub 1 minus the fraction n sub 1 open parenthesis n sub 1 plus 1 close parenthesis over 2 equals 459.5 minus the fraction 20 times 21 over 2 equals 249.5")[$U_(1) = R_(1) − frac(n_(1) ( n_(1) + 1 ), 2) = 459.5 − frac(20 · 21, 2) = 249.5$] #math.equation(block: true, alt: "U sub 2 equals R sub 2 minus the fraction n sub 2 open parenthesis n sub 2 plus 1 close parenthesis over 2 equals 443.5 minus the fraction 22 times 23 over 2 equals 190.5")[$U_(2) = R_(2) − frac(n_(2) ( n_(2) + 1 ), 2) = 443.5 − frac(22 · 23, 2) = 190.5$] #math.equation(block: true, alt: "U equals 190.5")[$U = 190.5$] #math.equation(block: true, alt: "z equals the fraction 190.5 minus open parenthesis the fraction 20 times 22 over 2 close parenthesis over the square root of open parenthesis the fraction 20 times 22 open parenthesis 20 plus 22 plus 1 close parenthesis over 12 close parenthesis equals minus 0.7429")[$z = frac(190.5 − ( frac(20 · 22, 2) ), sqrt(( frac(20 · 22 ( 20 + 22 + 1 ), 12) ))) = − 0.7429$] This test uses the standard normal distribution with the same technique for finding a p-value or critical value as the z-test performed in previous chapters. Compute the p-value for a standard normal distribution for #math.equation(block: false, alt: "z equals minus 0.7429")[$z = − 0.7429$] for a two-tailed test using #math.equation(block: false, alt: "2 * normalcdf open parenthesis minus 1 E 99 , minus 0.7429 , 0 , 1 close parenthesis equals 0.4575")[$2 * "normalcdf" ( − 1 E 99 , − 0.7429 , 0 , 1 ) = 0.4575$]. #figure(figph[Using a TI-84 calculator to find 2 times the normal cdf with parameters -1E99, -0.7429, 0, and 1, to get an answer of 0.45754.], alt: "Using a TI-84 calculator to find 2 times the normal cdf with parameters -1E99, -0.7429, 0, and 1, to get an answer of 0.45754.", caption: none) The p-value = #math.equation(block: false, alt: "0.4575 greater than α equals 0.05")[$0.4575 > α = 0.05$]; therefore, do not reject #math.equation(block: false, alt: "H sub 0")[$H_(0)$]. This is a two-tailed test with #math.equation(block: false, alt: "α equals 0.05")[$α = 0.05$]. Use the lower tail area of #math.equation(block: false, alt: "α / 2 equals 0.05")[$α / 2 = 0.05$] and you get critical values of #math.equation(block: false, alt: "z sub α / 2 equals ± 1.96")[$z_(α / 2) = ± 1.96$]. There is not enough evidence to support the claim that there is a difference in coffee sales between the Portland and Cannon beach stores. ] ] #strong[There are no shortcut keys on the TI calculators or Excel for this Nonparametric Test.] Note that if your data has tied ranks, there are several methods not addressed in this text, to correct the standard deviation. Hence, the z-score in some software packages may not match your results calculated by hand.