1 2 Sample Tests – Small Samples 1. Small sample, independent groups a. Test of equality of population variances b. If variances are equal, t-test c. If variances are not equal, Wilcoxon Rank Sum Test 2. Examples 2 1b. Small samples, independent groups We now turn to the case of comparing means for two independent, small samples (ns < 30). * There are 2 ways to do this – depending upon whether the two population variances are equal or different. * In order to know which method we should use, we have to test the hypothesis H0: 12 = 22 * So for small, independent samples, there are always 2 steps– test the variances, then test the means. 3 1b. Small samples, independent groups VERY IMPORTANT POINT: * We can only use the independent groups t-test when the two population variances are equal. * We must not assume that 12 = 22. * We must test H0: 12 = 22. * The test of hypothesis about the two population variances uses the ratio F= (12 / 22). 4 1b. Small samples, independent groups On an exam, you must test the hypothesis of equal variances before doing the independent groups ttest! If H0: 12 = 22 is rejected, we use the Wilcoxon Rank Sum test instead of the t-test. Note: before t-test only; not before Z test. 5 Test of hypothesis of equal variances Notes: * Next slide shows a formal statement of test of hypothesis about two population variances. * Both one-tailed and two-tailed tests are shown. * When you test equality of variances before doing small sample, independent groups t-test, always do a two-tailed test. * One-tailed test of equality of variances has other uses. 6 Test of hypothesis of equal variances H0: 12 = 22 HA: 12 < 22 or 12 > 22 Test statistic: H0: 12 = 22 HA: 12 ≠ 22 F= S12 S22 7 Test of hypothesis of equal variances Rejection region: One-tailed Two-tailed: F > Fα F > Fα/2 d.f. = (n1 – 1), (n2 – 1) (See note on next slide.) 8 α given in F table is value for upper tail. Since the F distribution is not symmetric, we have to compute critical F for lower tail. α 9 Computing critical F values for lower tail Critical F for upper tail of distribution is found in Table VII, using α and d.f. Critical F for lower tail of distribution: 1 Fα, n2-1, n1-1 Note that d.f. are inverted! 10 1b. Small samples, independent groups Now – back to our t-test. * If you do NOT reject H0 in the test of equality of variances, then you can pool the two sample variances: Sp2 = (n1-1)s12 + (n2-1)s22 n1 + n 2 - 2 11 1b. Small samples, independent groups H0: 1 – 2 = D0 HA: 1 – 2 > D0 or: 1 – 2 < D0 Test statistic: H0: 1 – 2 = D0 HA: 1 – 2 ≠ D0 t = ( X1 X2) – D0 Sp2 1 n1 ( 1 n2 ) 12 1b. Small samples, independent groups Rejection region: One-tailed: t < -tα or t > tα Two-tailed: │t│>tα/2 13 1b. Small samples, independent groups Wilcoxon Rank Sum Test * first, combine the two samples and rank order all the observations. * smallest number has rank 1, largest number has rank N (= sum of n1 and n2). * separate samples and add up the ranks for the smaller sample. (If n1 = n2, choose either one.) * test statistic : rank sum T for smaller sample. 14 1b. Small samples, independent groups Wilcoxon – One-tailed Hypotheses: H0: Prob. distributions for 2 sampled populations are identical. HA: Prob. distribution for Population A shifted to right of distribution for Population B. (Note: could be to the left, but must be one or the other, not both.) 15 1b. Small samples, independent groups Wilcoxon – Two-tailed Hypotheses: H0: Prob. distributions for 2 sampled populations are identical. HA: Prob. distribution for Population A shifted to right or left of distribution for Population B. 16 1b. Small samples, independent groups Wilcoxon – Rejection region: (With Sample taken from Population A being smaller than sample for Population B) – reject H0 if TA ≥ TU or TA ≤ TL 17 1b. Small samples, independent groups Wilcoxon for n1 ≥ 10 and n2 ≥ 10: Test statistic: Z= TA – n1(n1 + n2 + 1) 2 n1n2(n1 + n2 + 1) 12 18 Wilcoxon for n1≥ 10 and n2 ≥ 10 Rejection region: One-tailed Two-tailed Z > Zα │Z│ > Zα/2 Note: use this only when n1≥ 10 and n2 ≥ 10 19 Example 1 A retail store sales consultant is asked to determine whether customers at stores which require memberships spend more on average than customers at ordinary stores where you don’t have to buy a membership to shop. She surveys as group of 7 randomly selected customers leaving no-membership-required stores and 8 different randomly selected customers leaving membersip-required stores, recording the amount of their purchases shown on their sales receipts. The data are shown below. Is there evidence that customers at the membership-required stores, on average, spend more money on a single trip to the store than customers at no-membership-required stores? (α =.05) 20 Example 1 Amount spent No membership required 41 28 38 32 24 36 29 Membership required 44 36 35 43 39 36 50 37 21 Example 1 This question involves a test of hypothesis about 2 population means, using the means of two small, independent samples. Thus, the first step is the test of hypothesis about the population variances, σ12 and σ22. 22 Example 1 No membership required: X = 32.57 σ2 = 7646 – 7426.29 = 36.62 6 Membership required: X = 40.0 σ2 = 12992 – 12800 = 27.42 7 23 Example 1 HO: σ12 = σ22 HA: σ12 ≠ σ22 F critical = F (6, 7, .025) = 5.12 (from table) Fobt = 36.62 27.42 = 1.355 < 5.12 Therefore, we can do a t-test. 24 Example 1 HO: μnon2 = μmem2 HA: μnon2 < μmem2 t critical = t (n – 2, α) = t (13, .05) = 1.771 s2p = 6 (36.62) + 7 (27.42) = 31.67 13 25 Example 1 tobt = 40 – 32.57 31.67 + 31.67 7 8 = 7.43 4.524 + 3.959 = 7.43 2.913 = 2.55 reject HO. 26 Example 2 Many people are confused about the distinction between Cajun and Creole cooking. One possible distinction is that Cajun food contains more cayenne and other peppers and is thus “hotter” than Creole food. To test this hypothesis, the “heat” (measured in Scoville Units) of random samples of Cajun and Creole dishes is compared, yielding the data on the next slide. Do these data support the hypothesis that Cajun dishes are hotter than Creole dishes (α = .05)? 27 Example 2 Scoville Heat Units Cajun Dishes Creole Dishes 3500 3100 4200 4700 4100 2700 4700 3500 4200 2000 3705 3100 4100 1550 28 Example 2 Cajun: σ2 = 890592.8572 6 = 148432.14 Membership required: σ2 = 66334999.98 = 1055833.33 7 29 Example 2 HO: σ12 = σ22 HA: σ12 ≠ σ22 F critical = F (6, 6, .025) = 5.82 (from table) Fobt = 1055833.33 = 7.11 > 5.82 148432.14 Therefore, we cannot do a t-test. We do a Wilcoxon. 30 Example 2 HO: Cajun distribution and Creole distribution are identical. HA: Cajun distribution is shifted to the right relative to the Creole distribution. Test statistic: T (rank sum total) for Cajun dishes T critical: TU = 66 or TL = 39 31 Example 2 Scoville Heat Units Cajun Rank Creole Rank 3500 6.5 3100 4.5 4200 11.5 4700 13.5 4100 9.5 2700 3 4700 13.5 3500 6.5 4200 11.5 2000 2 3705 8 3100 4.5 4100 9.5 1550 1 70 35 32 Example 2 Check accuracy of rank sum total T: TA + TB = 105 = n*(n+1) = 14*15 = 105 2 2 TA > TU = 70. Reject HO – Cajun dishes are hotter than Creole dishes. 33