# Basic Business Statistics, 10/e - Pearson Education Statistics for Managers using Microsoft Excel 6th Global Edition Chapter 12 Chi-Square Tests and Nonparametric Tests Copyright 2011 Pearson Education 12-1 Learning Objectives In this chapter, you learn: How and when to use the chi-square test for contingency tables How to use the Marascuilo procedure for determining pairwise differences when evaluating more than two proportions How and when to use the McNemar test How and when to use nonparametric tests Copyright 2011 Pearson Education 12-2 Contingency Tables DCOVA Contingency Tables Useful in situations comparing multiple

population proportions Used to classify sample observations according to two or more characteristics Also called a cross-classification table. Copyright 2011 Pearson Education 12-3 Contingency Table Example DCOVA Left-Handed vs. Gender Dominant Hand: Left vs. Right Gender: Male vs. Female 2 categories for each variable, so this is called a 2 x 2 table Suppose we examine a sample of 300 children Copyright 2011 Pearson Education 12-4 Contingency Table Example (continued)

DCOVA Sample results organized in a contingency table: Hand Preference sample size = n = 300: 120 Females, 12 were left handed 180 Males, 24 were left handed Copyright 2011 Pearson Education Gender Left Right Female 12 108 120 Male 24 156 180

36 264 300 12-5 2 Test for the Difference Between Two Proportions DCOVA H0: 1 = 2 (Proportion of females who are leftProportion of females who are left handed is equal to the proportion of males who are left handed) H1: 1 2 (Proportion of females who are leftThe two proportions are not the same hand preference is not independent of gender) If H0 is true, then the proportion of left-handed females should be the same as the proportion of left-handed males The two proportions above should be the same as the proportion of left-handed people overall Copyright 2011 Pearson Education 12-6

The Chi-Square Test Statistic DCOVA The Chi-square test statistic is: 2 STAT all cells ( fo fe )2 fe where: fo = observed frequency in a particular cell fe = expected frequency in a particular cell if H0 is true 2 STAT for the 2 x 2 case has 1 degree of freedom (Proportion of females who are leftAssumed: each cell in the contingency table has expected frequency of at least 5) Copyright 2011 Pearson Education 12-7 Decision Rule DCOVA

2 The STAT test statistic approximately follows a chisquared distribution with one degree of freedom Decision Rule: 2 2 If STAT , reject H 0, otherwise, do not reject H0 Copyright 2011 Pearson Education 0 Do not reject H0 Reject H0 2 2 12-8 Computing the

Average Proportion DCOVA X1 X 2 X The average p proportion is: n1 n2 n 120 Females, 12 were left handed 180 Males, 24 were left handed Here: 12 24 36 p 0.12 120 180 300 i.e., based on all 180 children the proportion of left handers is 0.12, that is, 12% Copyright 2011 Pearson Education 12-9 Finding Expected Frequencies DCOVA

To obtain the expected frequency for left handed females, multiply the average proportion left handed (Proportion of females who are leftp) by the total number of females To obtain the expected frequency for left handed males, multiply the average proportion left handed (Proportion of females who are leftp) by the total number of males If the two proportions are equal, then P(Proportion of females who are leftLeft Handed | Female) = P(Proportion of females who are leftLeft Handed | Male) = .12 i.e., we would expect (.12)(120) = 14.4 females to be left handed (.12)(180) = 21.6 males to be left handed Copyright 2011 Pearson Education 12-10 Observed vs. Expected Frequencies DCOVA Hand Preference Gender Female Male Copyright 2011 Pearson Education Left

Right Observed = 12 Expected = 14.4 Observed = 24 Expected = 21.6 36 Observed = 108 Expected = 105.6 Observed = 156 Expected = 158.4 264 120 180 300 12-11 The Chi-Square Test Statistic Hand Preference Gender Female Male Left Right Observed = 12 Expected = 14.4 Observed = 24

Expected = 21.6 36 Observed = 108 Expected = 105.6 Observed = 156 Expected = 158.4 264 DCOVA 120 180 300 The test statistic is: 2STAT all cells (f o f e ) 2 fe (12 14.4) 2 (108 105.6) 2 (24 21.6) 2 (156 158.4) 2 0.7576 14.4 105.6 21.6

158.4 Copyright 2011 Pearson Education 12-12 Decision Rule DCOVA 2 The test statistic is STAT 0.7576 ; 02.05 with 1 d.f. 3.841 Decision Rule: 2 If STAT > 3.841, reject H0, otherwise, do not reject H0 0.05 0 Do not reject H0 Reject H0 20.05 = 3.841 Copyright 2011 Pearson Education 2

Here, 2 2 STAT = 0.7576< 0.05 = 3.841, so we do not reject H0 and conclude that there is not sufficient evidence that the two proportions are different at = 0.05 12-13 2 Test for Differences Among More Than Two Proportions DCOVA Extend the 2 test to the case with more than two independent populations: H 0: 1 = 2 = = c H1: Not all of the j are equal (Proportion of females who are leftj = 1, 2, , c) Copyright 2011 Pearson Education 12-14 The Chi-Square Test Statistic DCOVA The Chi-square test statistic is: 2

STAT all cells ( fo fe )2 fe Where: fo = observed frequency in a particular cell of the 2 x c table fe = expected frequency in a particular cell if H0 is true 2STAT for the 2 x c case has (2 - 1)(c - 1) c - 1 degrees of freedom (Proportion of females who are leftAssumed: each cell in the contingency table has expected frequency of at least 1) Copyright 2011 Pearson Education 12-15 Computing the Overall Proportion The overall proportion is: DCOVA X1 X 2 X c X p

n1 n2 nc n Expected cell frequencies for the c categories are calculated as in the 2 x 2 case, and the decision rule is the same: Decision Rule: 2 If STAT 2 , reject H 0, otherwise, do not reject H0 Copyright 2011 Pearson Education 2 Where is from the chi- squared distribution with c 1 degrees of freedom 12-16 The Marascuilo Procedure DCOVA

Used when the null hypothesis of equal proportions is rejected Enables you to make comparisons between all pairs Start with the observed differences, pj pj, for all pairs (Proportion of females who are leftfor j j) then compare the absolute difference to a calculated critical range Copyright 2011 Pearson Education 12-17 The Marascuilo Procedure (continued) DCOVA Critical Range for the Marascuilo Procedure: Critical range 2 p j (1 p j ) p j ' (1 p j ' ) nj n j' (Proportion of females who are leftNote: the critical range is different for each pairwise comparison)

A particular pair of proportions is significantly different if | pj pj| > critical range for j and j Copyright 2011 Pearson Education 12-18 Marascuilo Procedure Example DCOVA A University is thinking of switching to a trimester academic calendar. A random sample of 100 administrators, 50 students, and 50 faculty members were surveyed Opinion Administrators Students Favor 63 20 37 Oppose 37 30

13 100 50 50 Totals Faculty Using a 1% level of significance, which groups have a different attitude? Copyright 2011 Pearson Education 12-19 Chi-Square Test Results DCOVA H 0: 1 = 2 = 3 H1: Not all of the j are equal (Proportion of females who are leftj = 1, 2, 3) Chi-Square Test: Administrators, Students, Faculty Admin Favor Expected Students

63 20 60 30 30 Oppose 37 30 Total 37 Faculty Total 120 Observed 13 40 20

100 50 80 20 50 200 2 STAT 12.792 02.01 9.2103 so reject H 0 Copyright 2011 Pearson Education 12-20 Marascuilo Procedure: Solution DCOVA Excel Output: compare Marascuilo Procedure Sample Sample Absolute Std. Error Critical Group Proportion Size ComparisonDifference of Difference Range Results 1 0.63 100 1 to 2

0.23 0.084445249 0.2563 Means are not different 2 0.4 50 1 to 3 0.11 0.078606615 0.2386 Means are not different 3 0.74 50 2 to 3 0.34 0.092994624 0.2822 Means are different Other Data Level of significance 0.01 d.f 2 Q Statistic 3.034854 Chi-sq Critical Value 9.2103 At 1% level of significance, there is evidence of a difference in attitude between students and faculty Copyright 2011 Pearson Education 12-21 2 Test of Independence DCOVA Similar to the 2 test for equality of more than

two proportions, but extends the concept to contingency tables with r rows and c columns H0: The two categorical variables are independent (Proportion of females who are lefti.e., there is no relationship between them) H1: The two categorical variables are dependent (Proportion of females who are lefti.e., there is a relationship between them) Copyright 2011 Pearson Education 12-22 2 Test of Independence (continued) The Chi-square test statistic is: 2 STAT all cells DCOVA ( fo fe )2 fe where: fo = observed frequency in a particular cell of the r x c table

fe = expected frequency in a particular cell if H0 is true 2STAT for the r x c case has (r - 1)(c - 1) degrees of freedom (Proportion of females who are leftAssumed: each cell in the contingency table has expected frequency of at least 1) Copyright 2011 Pearson Education 12-23 Expected Cell Frequencies DCOVA Expected cell frequencies: row total column total fe n Where: row total = sum of all frequencies in the row column total = sum of all frequencies in the column n = overall sample size Copyright 2011 Pearson Education 12-24 Decision Rule DCOVA The decision rule is

2 , reject H , If 2 0 STAT otherwise, do not reject H0 2 Where is from the chi-squared distribution with (Proportion of females who are leftr 1)(Proportion of females who are leftc 1) degrees of freedom Copyright 2011 Pearson Education 12-25 Example DCOVA The meal plan selected by 200 students is shown below: Class Standing Fresh. Soph. Junior Senior Total Copyright 2011 Pearson Education

Number of meals per week 20/week 10/week none 24 22 10 14 70 32 26 14 16 88 14 12 6 10 42 Total 70 60 30 40 200 12-26 Example

DCOVA (continued) The hypothesis to be tested is: H0: Meal plan and class standing are independent (Proportion of females who are lefti.e., there is no relationship between them) H1: Meal plan and class standing are dependent (Proportion of females who are lefti.e., there is a relationship between them) Copyright 2011 Pearson Education 12-27 Example: Expected Cell Frequencies (continued) Observed: DCOVA Number of meals per week Class Standing 20/wk 10/wk

Expected cell frequencies if H0 is true: none Total Fresh. 24 32 14 70 Soph. 22 26 12 60 Junior 10 14

6 30 Senior 14 16 10 40 Total 70 88 42 200 Example for one cell: row total column total fe n 30 70 10.5 200 Copyright 2011 Pearson Education

Class Standing Fresh. Number of meals per week 20/wk 10/wk none Total 24.5 30.8 14.7 70 Soph. 21.0 26.4 12.6 60 Junior 10.5

13.2 6.3 30 Senior 14.0 17.6 8.4 40 70 88 42 200 Total 12-28 Example: The Test Statistic (continued) The test statistic value is:

2 STAT all cells DCOVA ( f o f e )2 fe ( 24 24.5 ) 2 ( 32 30.8 ) 2 ( 10 8.4 ) 2 0.709 24.5 30.8 8.4 0.2 05 = 12.592 from the chi-squared distribution with (Proportion of females who are left4 1)(Proportion of females who are left3 1) = 6 degrees of freedom Copyright 2011 Pearson Education 12-29 Example: Decision and Interpretation DCOVA

(continued) 2 The test statistic is STAT 0.709 ; 02.05 with 6 d.f. 12.592 Decision Rule: 2 If STAT > 12.592, reject H 0, otherwise, do not reject H0 Here, 0.05 0 Do not reject H0 Reject H0 20.05=12.592 Copyright 2011 Pearson Education 2 STAT = 0.709 < 0.2 05 = 12.592, 2 so do not reject H0 Conclusion: there is not

sufficient evidence that meal plan and class standing are related at = 0.05 12-30 McNemar Test (Proportion of females who are leftRelated Samples) DCOVA Used to determine if there is a difference between proportions of two related samples Uses a test statistic the follows the normal distribution Copyright 2011 Pearson Education 12-31 McNemar Test (Proportion of females who are leftRelated Samples) (continued) DCOVA Consider a 2 X 2 contingency table: Condition 2 Condition 1

Yes No Totals Yes A B A+B No C D C+D A+C B+D n Totals Copyright 2011 Pearson Education 12-32

McNemar Test (Proportion of females who are leftRelated Samples) (continued) The sample proportions of interest are DCOVA A B p1 proportion of respondents who answer yes to condition 1 n p2 A C proportion of respondents who answer yes to condition 2 n Test H0: 1 = 2 (Proportion of females who are leftthe two population proportions are equal) H1: 1 2 (Proportion of females who are leftthe two population proportions are not equal) Copyright 2011 Pearson Education 12-33

McNemar Test (Proportion of females who are leftRelated Samples) (continued) The test statistic for the McNemar test: Z STAT DCOVA B C BC where the test statistic Z is approximately normally distributed Copyright 2011 Pearson Education 12-34 McNemar Test Example Suppose you survey 300 homeowners and ask them if they are interested in refinancing their home. In an effort to generate business, a mortgage company improved their loan terms and reduced closing costs. The same homeowners were again surveyed. Determine if change in loan terms was effective in generating business for the mortgage company. The data are summarized as follows:

Copyright 2011 Pearson Education 12-35 McNemar Test Example DCOVA Survey response after change Survey response before change Yes No Totals Yes 118 2 120 No 22 158

180 140 160 300 Totals Test the hypothesis (at the 0.05 level of significance): H0: 1 2: The change in loan terms was ineffective H1: 1 < 2: The change in loan terms increased business Copyright 2011 Pearson Education 12-36 McNemar Test Example Survey response before change Survey response after change Yes No Totals

Yes 118 2 120 No 22 158 180 140 160 300 Totals DCOVA The critical value (0.05 significance) is Z0.05 = -1.645 The test statistic is: Z STAT B C

B C 2 22 2 22 4.08 Since ZSTAT = -4.08 < -1.645, you reject H0 and conclude that the change in loan terms significantly increase business for the mortgage company. Copyright 2011 Pearson Education 12-37 Wilcoxon Rank-Sum Test for Differences in 2 Medians DCOVA Test two independent population medians Populations need not be normally distributed Distribution free procedure Used when only rank data are available

Must use normal approximation if either of the sample sizes is larger than 10 Copyright 2011 Pearson Education 12-38 Wilcoxon Rank-Sum Test: Small Samples DCOVA Can use when both n1 , n2 10 Assign ranks to the combined n1 + n2 sample observations If unequal sample sizes, let n1 refer to smaller-sized sample Smallest value rank = 1, largest value rank = n1 + n2 Assign average rank for ties Sum the ranks for each sample: T1 and T2

Obtain test statistic, T1 (Proportion of females who are leftfrom smaller sample) Copyright 2011 Pearson Education 12-39 Checking the Rankings DCOVA The sum of the rankings must satisfy the formula below Can use this to verify the sums T1 and T2 n(Proportion of females who are leftn 1) T1 T2 2 where n = n1 + n2 Copyright 2011 Pearson Education 12-40 Wilcoxon Rank-Sum Test: Hypothesis and Decision Rule DCOVA M1 = median of population 1; M2 = median of population 2

Test statistic = T1 (Proportion of females who are leftSum of ranks from smaller sample) Two-Tail Test H0: M1 = M2 H1: M1 M2 Reject Do Not Reject T1L Reject T1U Reject H0 if T1 T1L Left-Tail Test H0: M1 M2 H1: M1 < M2 Reject Do Not Reject T1L Reject H0 if T1 T1L Right-Tail Test H0: M1 M2 H1: M1 M2 Do Not Reject Reject T1U

Reject H0 if T1 T1U or if T1 T1U Copyright 2011 Pearson Education 12-41 Wilcoxon Rank-Sum Test: Small Sample Example DCOVA Sample data are collected on the capacity rates (Proportion of females who are left% of capacity) for two factories. Are the median operating rates for two factories the same? For factory A, the rates are 71, 82, 77, 94, 88 For factory B, the rates are 85, 82, 92, 97 Test for equality of the population medians at the 0.05 significance level Copyright 2011 Pearson Education 12-42 Wilcoxon Rank-Sum Test: Small Sample Example DCOVA (continued)

Ranked Capacity values: Tie in 3rd and 4th places Capacity Factory A Rank Factory B Factory A 71 1 77 2 82 3.5 82 3.5 85 5

88 6 92 94 7 8 97 Rank Sums: Copyright 2011 Pearson Education Factory B 9 20.5 24.5 12-43 Wilcoxon Rank-Sum Test: Small Sample Example DCOVA (continued) Factory B has the smaller sample size, so the test statistic is the sum of the Factory B ranks: T1 = 24.5

The sample sizes are: n1 = 4 (Proportion of females who are leftfactory B) n2 = 5 (Proportion of females who are leftfactory A) The level of significance is = .05 Copyright 2011 Pearson Education 12-44 Wilcoxon Rank-Sum Test: Small Sample Example DCOVA (continued) Lower and Upper Critical Values for T1 from Appendix table E.8: n1 n2 OneTailed TwoTailed

4 5 .05 .10 12, 28 19, 36 .025 .05 11, 29 17, 38 .01 .02 10, 30 16, 39 .005 .01 --, --

15, 40 4 5 6 Copyright 2011 Pearson Education T1L = 11 and T1U = 29 12-45 Wilcoxon Rank-Sum Test: Small Sample Solution DCOVA (continued) = .05 n1 = 4 , n2 = 5 Test Statistic (Proportion of females who are leftSum of ranks from smaller sample): Two-Tail Test H0: M1 = M2 H1: M1 M2 T1 = 24.5

Reject Do Not Reject T1L=11 Reject T1U=29 Reject H0 if T1 T1L=11 or if T1 T1U=29 Copyright 2011 Pearson Education Decision: Do not reject at = 0.05 Conclusion: There is not enough evidence to prove that the medians are not equal. 12-46 Wilcoxon Rank-Sum Test (Proportion of females who are leftLarge Sample) DCOVA For large samples, the test statistic T1 is approximately normal with mean T and standard deviation T : 1

1 n1(n 1 ) T1 2 n1 n2 (n 1) T1 12 Must use the normal approximation if either n1 or n2 > 10 Assign n1 to be the smaller of the two sample sizes Should not use the normal approximation for small samples Copyright 2011 Pearson Education 12-47 Wilcoxon Rank-Sum Test (Proportion of females who are leftLarge Sample) (continued) DCOVA

The Z test statistic is Z STAT T1 T 1 T 1 T1 n 1 (n 1) 2 n 1 n 2 (n 1) 12 Where ZSTAT approximately follows a standardized normal distribution Copyright 2011 Pearson Education 12-48 Wilcoxon Rank-Sum Test:

Normal Approximation Example DCOVA Use the setting of the prior example: The sample sizes were: n1 = 4 (Proportion of females who are leftfactory B) n2 = 5 (Proportion of females who are leftfactory A) The level of significance was = .05 The test statistic was T1 = 24.5 Copyright 2011 Pearson Education 12-49 Wilcoxon Rank-Sum Test: Normal Approximation Example (continued) T1 n1(Proportion of females who are leftn 1) 4(Proportion of females who are left9 1) 20 2 2 T 1 n1 n 2 ( n 1 )

12 DCOVA 4 ( 5 )( 9 1 ) 4.082 12 The test statistic is T1 T 24.5 20 1 Z STAT 1.10 T 4.0882 1 Z = 1.10 is not greater than the critical Z value of 1.96 (Proportion of females who are leftfor = .05) so we do not reject H0 there is not sufficient evidence that the medians are not equal Copyright 2011 Pearson Education 12-50 Kruskal-Wallis Rank Test

DCOVA Tests the equality of more than 2 population medians Use when the normality assumption for oneway ANOVA is violated Assumptions: The samples are random and independent Variables have a continuous distribution The data can be ranked Populations have the same variability Populations have the same shape Copyright 2011 Pearson Education 12-51 Kruskal-Wallis Test Procedure DCOVA Obtain rankings for each value

In event of tie, each of the tied values gets the average rank Sum the rankings for data from each of the c groups Compute the H test statistic Copyright 2011 Pearson Education 12-52 Kruskal-Wallis Test Procedure (continued) The Kruskal-Wallis H-test statistic: DCOVA (Proportion of females who are leftwith c 1 degrees of freedom) c T2 12 j H 3(Proportion of females who are leftn 1) n(Proportion of females who are leftn 1) j1 n j

where: n = sum of sample sizes in all groups c = Number of groups Tj = Sum of ranks in the jth group nj = Number of values in the jth group (Proportion of females who are leftj = 1, 2, , c) Copyright 2011 Pearson Education 12-53 Kruskal-Wallis Test Procedure (continued) DCOVA Complete the test by comparing the calculated H value to a critical 2 value from the chi-square distribution with c 1 degrees of freedom 0 Do not reject H0 2 Reject H0

Copyright 2011 Pearson Education 2 Decision rule Reject H0 if test statistic H > 2 Otherwise do not reject H0 12-54 Kruskal-Wallis Example DCOVA Do different departments have different class sizes? Class size (Proportion of females who are leftMath, M) 23 45 54 78 66 Copyright 2011 Pearson Education Class size

(Proportion of females who are leftEnglish, E) 55 60 72 45 70 Class size (Proportion of females who are leftBiology, B) 30 40 18 34 44 12-55 Kruskal-Wallis Example DCOVA (continued) Do different departments have different class sizes? Class size Class size Ranking Ranking (Proportion of females who are leftMath, M) (Proportion of females who are leftEnglish, E)

23 2 55 10 41 6 60 11 54 9 72 14 78 15 45 8 66 12 70 13 = 44 = 56 Copyright 2011 Pearson Education Class size (Proportion of females who are leftBiology, B) 30 40 18 34 44

Ranking 3 5 1 4 7 = 20 12-56 Kruskal-Wallis Example DCOVA (continued) H 0 : Median M Median E Median B H1 : Not all population Medians are equal The H statistic is c T2 12 j H 3(n 1) n(n 1) j1 n j 44 2 56 2 20 2 12 3(15 1) 6.72

5 5 15(15 1) 5 Copyright 2011 Pearson Education 12-57 Kruskal-Wallis Example DCOVA (continued) Compare H = 7.12 to the critical value from the chi-square distribution for 3 1 = 2 degrees of freedom and = 0.05: 02.05 5.991 2 Since H = 7.12 > 0.05 5.991, reject H0 There is sufficient evidence to reject that the population medians are all equal Copyright 2011 Pearson Education 12-58

Chapter Summary Developed and applied the 2 test for the difference between two proportions Developed and applied the 2 test for differences in more than two proportions Applied the Marascuilo procedure for comparing all pairs of proportions after rejecting a 2 test Examined the 2 test for independence Applied the McNemar test for proportions from two related samples Copyright 2011 Pearson Education 12-59 Chapter Summary (continued) Used the Wilcoxon rank sum test for two population medians Applied the Kruskal-Wallis H-test for multiple

population medians Copyright 2011 Pearson Education 12-60 Statistics for Managers using Microsoft Excel 6th Edition On Line Topic Chi-Square Tests for The Variance or Standard Deviation Copyright 2011 Pearson Education 12-61 Learning Objectives In this topic, you learn: How to use the Chi-Square to test for a variance or standard deviation Copyright 2011 Pearson Education 12-62 Chi-Square Test for a Variance or Standard Deviation DCOVA A 2 test statistic is used to test whether or not the population variance or standard deviation is equal to a specified value: H0: 2 = 02

Ha: 0 2 2 2 STAT (n - 1)S 2 2 Where n = sample size S22= sample variance 2STAT = hypothesized population variance 2 a chi-square 2 2 2 follows distribution with d.f. = n - 1 Reject H0 if STAT > / 2 or if STAT < 1 / 2 Copyright 2011 Pearson Education 12-63 Chi-Square Test For A Variance: DCOVA An Example Suppose you have gathered a random sample of size 25 and

obtained a sample standard deviation of s = 7 and want to do the following hypothesis test: H0: 2 = 81 Ha: 2 81 2 STAT 2 (n - 1)S 2 24 * 49 14.185 2 81 2 Since 0.975 12.401 < 14.185 < 0.025 39.364 you fail to reject H 0 Copyright 2011 Pearson Education 12-64 Topic Summary Examined how to use the Chi-Square to test for a variance or standard deviation Copyright 2011 Pearson Education 12-65 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying,

recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Copyright 2011 Pearson Education 12-66