Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-1Chap 12-1
Chapter 12
Chi-Square Tests and Nonparametric Tests
Basic Business Statistics12th Edition
Chap 12-2Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-2
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 to use the Chi-Square to test for a variance
or standard deviation How and when to use nonparametric tests
Chap 12-3Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-3
Contingency Tables
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.
DCOVA
Chap 12-4Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-4
Contingency Table Example
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
DCOVA
Chap 12-5Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-5
Contingency Table Example
Sample results organized in a contingency table:
(continued)
Gender
Hand Preference
Left Right
Female 12 108 120
Male 24 156 180
36 264 300
120 Females, 12 were left handed
180 Males, 24 were left handed
sample size = n = 300:
DCOVA
Chap 12-6Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-6
2 Test for the Difference Between Two Proportions
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
H0: π1 = π2 (Proportion of females who are left
handed is equal to the proportion of
males who are left handed)
H1: π1 ≠ π2 (The two proportions are not the same –
hand preference is not independent
of gender)
DCOVA
Chap 12-7Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-7
The Chi-Square Test Statistic
where:
fo = observed frequency in a particular cell
fe = expected frequency in a particular cell if H0 is true
(Assumed: each cell in the contingency table has expectedfrequency of at least 5)
cells
22 )(
all e
eoSTAT f
ff
The Chi-square test statistic is:
freedom of degree 1 has case 2x 2 thefor 2STAT
DCOVA
Chap 12-8Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-8
Decision Rule
2
2α
Decision Rule:
If , reject H0, otherwise, do not reject H0
The test statistic approximately follows a chi-squared distribution with one degree of freedom
0
Reject H0Do not reject H0
2STAT
χ
22αSTAT
χ χ
DCOVA
Chap 12-9Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-9
Computing the Average Proportion
Here: 120 Females, 12 were left handed
180 Males, 24 were left handed
i.e., based on all 300 children the proportion of left handers is 0.12, that is, 12%
n
X
nn
XXp
21
21
12.0300
36
180120
2412
p
The average proportion is:
DCOVA
Chap 12-10Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-10
Finding Expected Frequencies
To obtain the expected frequency for left handed females, multiply the average proportion left handed (p) by the total number of females
To obtain the expected frequency for left handed males, multiply the average proportion left handed (p) by the total number of males
If the two proportions are equal, then
P(Left Handed | Female) = P(Left 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
DCOVA
Chap 12-11Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-11
Observed vs. Expected Frequencies
Gender
Hand Preference
Left Right
FemaleObserved = 12
Expected = 14.4Observed = 108
Expected = 105.6120
MaleObserved = 24
Expected = 21.6Observed = 156
Expected = 158.4180
36 264 300
DCOVA
Chap 12-12Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-12
Gender
Hand Preference
Left Right
FemaleObserved = 12
Expected = 14.4Observed = 108
Expected = 105.6120
MaleObserved = 24
Expected = 21.6Observed = 156
Expected = 158.4180
36 264 300
0.7576158.4
158.4)(156
21.6
21.6)(24
105.6
105.6)(108
14.4
14.4)(12
f
)f(fχ
2222
cells all e
2eo2
STAT
The Chi-Square Test Statistic
The test statistic is:
DCOVA
Chap 12-13Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-13
Decision Rule
Decision Rule:If > 3.841, reject H0, otherwise, do not reject H0
3.841 d.f. 1 with ; 0.7576 is statistictest The 205.0
2 χχSTAT
Here, =0.7576 < = 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
2
20.05 = 3.841
0
0.05
Reject H0Do not reject H0
2STAT
2STATχ 2
05.0χ
DCOVA
Chap 12-14Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Chi-Square Test In Excel
Chap 12-14
Chi-Square Test
Observed Frequencies
Hand Preference CalculationsGender Left Right Total f0 - feFemale 12 108 120 -2.4 2.4Male 24 156 180 2.4 -2.4Total 36 264 300
Expected Frequencies Hand Preference
Gender Left Right Total (f0 - fe)^2/feFemale 14.4 105.6 120 0.40 0.05Male 21.6 158.4 180 0.27 0.04Total 36 264 300
DataLevel of Significance 0.05Number of Rows 2Number of Columnns 2Degrees of Freedom 1=(B19-1)*(B20-1)
ResultsCritical Value 3.8415=CHIINV(B18,B21)Chi-Square Test Statistic 0.7576=SUM(F13:G14)p-Value 0.3841=CHIDIST(B25,B21)
Do not reject the null hypothesis =IF(B26<B18,"Reject the null hypothesis","Do not reject the null hypothesis")
Expected Frequency assumption is met. =IF(OR(B13<5,C13<5,B14<5,C14<5),
" is violated."," is met.")
DCOVA
Chap 12-15Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-15
Chi-Square Test In Minitab
Tabulated statistics: Gender, Hand
(Expected counts are below observed)
(Chi-Square cell contribution below expected counts)
Rows: Gender Columns: Hand
Left Right All
Female 12 108 120
14.4 105.6 120.0
0.40000 0.05455 *
Male 24 156 180
21.6 158.4 180.0
0.26667 0.03636 *
All 36 264 300
36.0 264.0 300.0
* * *
Pearson Chi-Square = 0.758, DF = 1, P-Value = 0.384
DCOVA
Chap 12-16Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-16
Extend the 2 test to the case with more than two independent populations:
2 Test for Differences Among More Than Two Proportions
H0: π1 = π2 = … = πc
H1: Not all of the πj are equal (j = 1, 2, …, c)
DCOVA
Chap 12-17Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-17
The Chi-Square Test Statistic
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
(Assumed: each cell in the contingency table has expectedfrequency of at least 1)
cells
22 )(
all e
eoSTAT f
ff
The Chi-square test statistic is:
freedom of degrees 1-c 1)-1)(c-(2 has case cx 2 thefor χ 2 STAT
DCOVA
Chap 12-18Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-18
Computing the Overall Proportion
n
X
nnn
XXXp
c
c
21
21 The overall proportion is:
Expected cell frequencies for the c categories are calculated as in the 2 x 2 case, and the decision rule is the same:
Where is from the chi-squared distribution with c – 1 degrees of freedom
Decision Rule:If , reject H0, otherwise, do not reject H0
22αSTAT
χ χ
2α
χ
DCOVA
Chap 12-19Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-19
Example of 2 Test for Differences Among More Than Two Proportions
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 Faculty
Favor 63 20 37
Oppose 37 30 13
Totals 100 50 50
Using a 1% level of significance, which groups have a different attitude?
DCOVA
Chap 12-20Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-20
Chi-Square Test Results
Chi-Square Test: Administrators, Students, Faculty
Admin Students Faculty Total
Favor 63 20 37 120
60 30 30
Oppose 37 30 13 80
40 20 20
Total 100 50 50 200
ObservedExpected
H0: π1 = π2 = π3
H1: Not all of the πj are equal (j = 1, 2, 3)
02
0102 Hreject so 9.2103 79212
.STATχ.χ
DCOVA
Chap 12-21Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Excel Output For The Example
Chap 12-21
DCOVAChi-Square Test
Observed Frequencies Role Calculations
Opinion Admin Students Faculty Total fo - feFavor 63 20 37 120 3.0000 -10.0000 7
Oppose 37 30 13 80 -3.0000 10.0000 -7Total 100 50 50 200
Expected Frequencies Role
Opinion Admin Students Faculty Total (fo - fe)^2/feFavor 60.0 30.0 30.0 120 0.1500 3.3333 1.6333
Oppose 40.0 20.0 20.0 80 0.2250 5.0000 2.4500Total 100 50 50 200
DataLevel of Significance 0.01Number of Rows 2Number of Columns 3Degrees of Freedom 2=($B$19 - 1) * ($B$20 - 1)
ResultsCritical Value 9.2103=CHIINV(B18, B21)Chi-Square Test Statistic 12.7917=SUM(G13:I14)p-Value 0.0017=CHIDIST(B25, B21)
Reject the null hypothesis =IF(B26<B18, "Reject the null hypothesis",Do not reject the null hypothesis")
Expected frequency assumption is met. =IF(OR(B13<1, C13<1, D13<1, B14<1, C14<1, D14<1),
" is violated.", " is met.")
Chap 12-22Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Minitab Output For The Example
Chap 12-22
DCOVATabulated statistics: Position, Role
Rows: Position Columns: Role
Admin Faculty Students All
Favor 63 37 20 120
60 30 30 120
0.150 1.633 3.333 *
Oppose 37 13 30 80
40 20 20 80
0.225 2.450 5.000 *
All 100 50 50 200
100 50 50 200
* * * *
Pearson Chi-Square = 12.792, DF = 2, P-Value = 0.002
Chap 12-23Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-23
The Marascuilo Procedure
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 (for j ≠ j’) then compare the absolute difference to a calculated critical range
DCOVA
Chap 12-24Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-24
The Marascuilo Procedure
Critical Range for the Marascuilo Procedure:
(Note: 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’
(continued)
'j
'j'j
j
jj2
n
)p(1p
n
)p(1pχrange Critical
α
DCOVA
Chap 12-25Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-25
Marascuilo Procedure Example
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 Faculty
Favor 63 20 37
Oppose 37 30 13
Totals 100 50 50
Using a 1% level of significance, which groups have a different attitude?
DCOVA
Chap 12-26Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-26
Chi-Square Test Results
Chi-Square Test: Administrators, Students, Faculty
Admin Students Faculty Total
Favor 63 20 37 120
60 30 30
Oppose 37 30 13 80
40 20 20
Total 100 50 50 200
ObservedExpected
H0: π1 = π2 = π3
H1: Not all of the πj are equal (j = 1, 2, 3)
02
0102 Hreject so 9.2103 79212
.STATχ.χ
DCOVA
Chap 12-27Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-27
Marascuilo Procedure: Solution
Marascuilo Procedure
Sample Sample Absolute Std. Error CriticalGroup Proportion Size ComparisonDifference of Difference Range Results
1 0.63 100 1 to 2 0.23 0.084445249 0.2563 Means are not different2 0.4 50 1 to 3 0.11 0.078606615 0.2386 Means are not different3 0.74 50 2 to 3 0.34 0.092994624 0.2822 Means are different
0.01 9.21032
3.034854
Chi-sq Critical ValueOther Data
d.fQ Statistic
Level of significance
Calculations In Excel:
compare
At 1% level of significance, there is evidence of a difference in attitude between students and faculty
DCOVA
Minitab does not do the Marascuilo procedure
Chap 12-28Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-28
2 Test of Independence
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
(i.e., there is no relationship between them)
H1: The two categorical variables are dependent
(i.e., there is a relationship between them)
DCOVA
Chap 12-29Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-29
2 Test of Independence
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
(Assumed: each cell in the contingency table has expected
frequency of at least 1)
cells
22
)(
all e
eoSTAT f
ffχ
The Chi-square test statistic is:
(continued)
freedom of degrees 1)-1)(c-(r has case cr x for the χ 2STAT
DCOVA
Chap 12-30Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-30
Expected Cell Frequencies
Expected cell frequencies:
n
total columntotalrow fe
Where:
row total = sum of all frequencies in the row
column total = sum of all frequencies in the column
n = overall sample size
DCOVA
Chap 12-31Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-31
Decision Rule
The decision rule is
Where is from the chi-squared distribution with (r – 1)(c – 1) degrees of freedom
If , reject H0,
otherwise, do not reject H0
22αSTAT
χ χ
2α
χ
DCOVA
Chap 12-32Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-32
Example
The meal plan selected by 200 students is shown below:
ClassStanding
Number of meals per weekTotal20/week 10/week none
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
DCOVA
Chap 12-33Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-33
Example
The hypothesis to be tested is:
(continued)
H0: Meal plan and class standing are independent
(i.e., there is no relationship between them)
H1: Meal plan and class standing are dependent
(i.e., there is a relationship between them)
DCOVA
Chap 12-34Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-34
ClassStanding
Number of meals per week
Total20/wk 10/wk none
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
ClassStanding
Number of meals per week
Total20/wk 10/wk none
Fresh. 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
Total 70 88 42 200
Observed:
Expected cell frequencies if H0 is true:
5.10200
7030
n
total columntotalrow fe
Example for one cell:
Example: Expected Cell Frequencies
(continued)
DCOVA
Chap 12-35Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-35
Example: The Test Statistic
The test statistic value is:
709048
4810
830
83032
524
52424 222
cells
22
..
).(
.
).(
.
).(
f
)ff(χ
all e
eoSTAT
(continued)
= 12.592 from the chi-squared distribution with (4 – 1)(3 – 1) = 6 degrees of freedom
2050.
χ
DCOVA
Chap 12-36Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-36
Example: Decision and Interpretation
(continued)
Decision Rule:If > 12.592, reject H0, otherwise, do not reject H0
12.592 d.f. 6 with ; 7090 is statistictest The 2050
2 .STAT
χ.χ
Here, = 0.709 < = 12.592, so do not reject H0 Conclusion: there is not sufficient evidence that meal plan and class standing are related at = 0.05
2
20.05=12.592
0
0.05
Reject H0Do not reject H0
2STAT
χ
2STAT
χ 2050.
χ
DCOVA
Chap 12-37Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Excel Output Of Example
Chap 12-37
DCOVAChi-Square Test of Independence
Observed Frequencies Meals Per Week Calculations
Class Standing 20/wk 10/wk None Total fo - feFresh. 24 32 14 70 -0.5000 1.2000 -0.7000Soph. 22 26 12 60 1.0000 -0.4000 -0.6000Junior 10 14 6 30 -0.5000 0.8000 -0.3000Senior 14 16 10 40 0.0000 -1.6000 1.6000Total 70 88 42 200
Expected Frequencies Meals Per Week
Class Standing 20/wk 10/wk None Total (fo - fe)^2/feFresh. 24.5000 30.8000 14.7000 70 0.0102 0.0468 0.0333Soph. 21.0000 26.4000 12.6000 60 0.0476 0.0061 0.0286Junior 10.5000 13.2000 6.3000 30 0.0238 0.0485 0.0143Senior 14.0000 17.6000 8.4000 40 0.0000 0.1455 0.3048Total 70 88 42 200
DataLevel of Significance 0.05Number of Rows 4Number of Columns 3Degrees of Freedom 6=($B$23 - 1) * ($B$24 - 1)
ResultsCritical Value 12.5916=CHIINV(B22, B25)Chi-Square Test Statistic 0.7093=SUM($G$15:$I$18)p-Value 0.9943=CHIDIST(B29, B25)
Do not reject the null hypothesis =IF(B30<B22, "Reject the null hypothesis",Do not reject the null hypothesis)
Expected frequency assumption is met. =IF(OR(B15<1, C15<1, D15<1, B16<1, C16<1, D16<1, B17<1, C17<1,
D17<1, B18<1, C18<1, D18<1), " is violated.", " is met.")
Chap 12-38Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Minitab Output Of Example
Chap 12-38
DCOVATabulated statistics: Class, Meals
Rows: Class Columns: Meals
0 10 20 All
Fresh 14 32 24 70
14.70 30.80 24.50 70.00
0.03333 0.04675 0.01020 *
Junior 6 14 10 30
6.30 13.20 10.50 30.00
0.01429 0.04848 0.02381 *
Senior 10 16 14 40
8.40 17.60 14.00 40.00
0.30476 0.14545 0.00000 *
Soph 12 26 22 60
12.60 26.40 21.00 60.00
0.02857 0.00606 0.04762 *
All 42 88 70 200
42.00 88.00 70.00 200.
* * * *
Pearson Chi-Square = 0.709, DF = 6, P-Value = 0.994
Chap 12-39Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-39
McNemar Test (Related Samples)
Used to determine if there is a difference between proportions of two related samples
Uses a test statistic the follows the normal distribution
DCOVA
Chap 12-40Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-40
McNemar Test (Related Samples)
Consider a 2 X 2 contingency table:
(continued)
Condition 2
Condition 1 Yes No Totals
Yes A B A+B
No C D C+D
Totals A+C B+D n
DCOVA
Chap 12-41Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-41
McNemar Test (Related Samples)
The sample proportions of interest are
Test H0: π1 = π2 (the two population proportions are equal)
H1: π1 ≠ π2 (the two population proportions are not equal)
(continued)
2 condition to yesanswer whosrespondent of proportionn
CAp
1 condition to yesanswer whosrespondent of proportionn
BAp
2
1
DCOVA
Chap 12-42Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-42
McNemar Test (Related Samples)
The test statistic for the McNemar test:
where the test statistic Z is approximately normally distributed
(continued)
CB
CBZ
STAT
DCOVA
Chap 12-43Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-43
McNemar TestExample
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:
Chap 12-44Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-44
McNemar TestExample
Survey response before change
Survey response after change
Yes No Totals
Yes 118 2 120
No 22 158 180
Totals 140 160 300
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
DCOVA
Chap 12-45Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-45
McNemar Test Example
Survey response before change
Survey response after change
Yes No Totals
Yes 118 2 120
No 22 158 180
Totals 140 160 300
The critical value (0.05 significance) is Z0.05 = -1.645
The test statistic is:
08.4222
222
CB
CBZSTAT
Since ZSTAT = -4.08 < -1.645, you reject H0 and conclude that the change in loan terms significantly increase business for the mortgage company.
DCOVA
Chap 12-46Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Excel Output Of McNemar Test
Chap 12-46
Minitab does not have a command for the McNemar test
McNemar Test
Observed Frequencies After Change
Before Change Yes No TotalYes 118 2 120No 22 158 180
Total 140 160 300
DataLevel of Significance 0.05
Intermediate CalculationsNumerator -20=C6-B7Denominator 4.8990=SQRT(C6+B7)Z Test Statistic -4.0825=B14/B15
One-Tail TestLower Critical Value -1.6449=NORMSINV(B11)p-Value 0.0000=NORMSDIST(B16)
Reject the null hypothesis =IF(B21<B11,"Reject the null hypothesis",Do not reject the null hypothesis)
DCOVA
Chap 12-47Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Chi-Square Test for a Variance or Standard Deviation
A χ2 test statistic is used to test whether or not the population variance or standard deviation is equal to a specified value:
Where n = sample size
S2 = sample variance
σ2 = hypothesized population variance
follows a chi-square distribution with d.f. = n - 1
2
22
σ
1)S-(n
STATχ
2STATχ
H0: σ2 = σ02
Ha: σ2 ≠ σ02
Reject H0 if > or if < 2STAT 2
2/ 2STAT 2
2/1
DCOVA
Chap 12-47
Chap 12-48Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
DCOVA
Chi-Square Test For A Variance: An Example
Suppose you have gathered a random sample of size 25 andobtained a sample standard deviation of S = 7 and want to do the following hypothesis test:
H0: σ2 = 81
Ha: σ2 ≠ 81
5185.1481
49*24
σ
1)S-(n2
22 STATχ
Since < 14.185 < you fail to reject H0401.122
975.0 364.392025.0
Chap 12-48
Chap 12-49Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Excel Output For Chi-Square Test For A Variance
Chap 12-49
DCOVAChi-Square Test For A Variance
Data Null Hypothesis s^2= 81Level of Significance 0.05Sample Size 25Sample Standard Deviation 7
Intermediate CalculationsDegrees of Freedom 24=B6-1Half Area 0.025=B5/2Chi-Square Statistic 14.5185=B10*B7^2/B4
Two-Tail Test
Lower Critical Value 12.4012=CHIINV(1-B11,B10)
Upper Critical Value 39.3641=CHIINV(B11,B10)
p-Value 0.9341=IF((B12-B15)<0,1-CHIDIST(B12,B10),CHIDIST(B12,B10))
Do not reject the null hypothesis =IF(B17<$B$5/2,"Reject the null hypothesis",Do not reject the null hypothesis)
Minitab does not have a command for the McNemar test
Chap 12-50Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-50
Wilcoxon Rank Sum Test for Differences in 2 Medians
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
DCOVA
Chap 12-51Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-51
Wilcoxon Rank Sum Test: Small Samples
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 (from smaller sample)
DCOVA
Chap 12-52Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-52
Checking the Rankings
The sum of the rankings must satisfy the formula below
Can use this to verify the sums T1 and T2
2
1)n(nTT 21
where n = n1 + n2
DCOVA
Chap 12-53Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-53
Wilcoxon Rank Sum Test:Hypothesis and Decision Rule
H0: M1 = M2
H1: M1 ¹ M2
H0: M1 £ M2
H1: M1 > M2
H0: M1 ³ M2
H1: M1 < M2
Two-Tail Test Left-Tail Test Right-Tail Test
M1 = median of population 1; M2 = median of population 2
Reject
T1L T1U
RejectDo Not Reject
Reject
T1L
Do Not Reject
T1U
RejectDo Not Reject
Test statistic = T1 (Sum of ranks from smaller sample)
Reject H0 if T1 ≤ T1L
or if T1 ≥ T1U
Reject H0 if T1 ≤ T1L Reject H0 if T1 ≥ T1U
DCOVA
Chap 12-54Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-54
Sample data are collected on the capacity rates (% 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
Wilcoxon Rank Sum Test: Small Sample Example DCOVA
Chap 12-55Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-55
Wilcoxon Rank Sum Test: Small Sample Example
Capacity Rank
Factory A Factory B Factory A Factory B
71 1
77 2
82 3.5
82 3.5
85 5
88 6
92 7
94 8
97 9
Rank Sums: 20.5 24.5
Tie in 3rd and 4th places
RankedCapacityvalues:
(continued)DCOVA
Chap 12-56Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-56
Wilcoxon Rank Sum Test: Small Sample Example
(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 (factory B)
n2 = 5 (factory A)
The level of significance is = .05
DCOVA
Chap 12-57Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-57
n2
a n1
One-Tailed
Two-Tailed 4 5
4
5
.05 .10 12, 28 19, 36
.025 .05 11, 29 17, 38
.01 .02 10, 30 16, 39
.005 .01 --, -- 15, 40
6
Wilcoxon Rank Sum Test: Small Sample Example
Lower and Upper Critical Values for T1 from
Appendix table E.8:
(continued)
T1L = 11 and T1U = 29
DCOVA
Chap 12-58Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-58
H0: M1 = M2
H1: M1 ¹ M2
Two-Tail Test
Reject
T1L=11 T1U=29
RejectDo Not Reject
Reject H0 if T1 ≤ T1L=11
or if T1 ≥ T1U=29
a = .05 n1 = 4 , n2 = 5
Test Statistic (Sum of ranks from smaller sample):
T1 = 24.5
Decision:
Conclusion:
Do not reject at a = 0.05
There is not enough evidence to prove that the medians are not equal.
Wilcoxon Rank Sum Test:Small Sample Solution
(continued)
DCOVA
Chap 12-59Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-59
Wilcoxon Rank Sum Test (Large Sample)
For large samples, the test statistic T1 is
approximately normal with mean and standard deviation :
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
1Tμ
1Tσ
2
1μ 1
1
)(nnT
12
)1(σ 21
1
nnnT
DCOVA
Chap 12-60Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-60
Wilcoxon Rank Sum Test (Large Sample)
The Z test statistic is
Where ZSTAT approximately follows a standardized normal distribution
12
1)(nnn2
1)(nnT
σ
μTZ
21
11
T
T1
1
1
STAT
(continued)
DCOVA
Chap 12-61Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-61
Wilcoxon Rank Sum Test: Normal Approximation Example
Use the setting of the prior example:
The sample sizes were:
n1 = 4 (factory B)
n2 = 5 (factory A)
The level of significance was α = .05
The test statistic was T1 = 24.5
DCOVA
Chap 12-62Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-62
Wilcoxon Rank Sum Test: Normal Approximation Example
The test statistic is
202
)19(4
2
)1n(nμ 1
T1
082412
1954
12
1σ 21
1
.)()()n(nn
T
(continued)
10.14.082
205.24
σ
μZ
1
11
T
TSTAT
T
Z = 1.10 is not greater than the critical Z value of 1.96 (for α = .05) so we do not reject H0 – there is not
sufficient evidence that the medians are not equal
DCOVA
Chap 12-63Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Example Excel Output
Chap 12-63
DCOVAWilcoxon Rank Sum Test
Data Level of Significance 0.05
Population 1 Sample Sample Size 4Sum of Ranks 24.5
Population 2 Sample Sample Size 5Sum of Ranks 20.5
Intermediate CalculationsTotal Sample Size n 9=B7+B10T1 Test Statistic 24.5=IF(B7<=B10,B8,B11)T1 Mean 20=IF(B7<=B10,B7*(B14+1)/2,B10*(B14+1)/2)Standard Error of T1 4.0825=SQRT(B7*B10*(B14+1)/12)Z Test Statistic 1.1023=(B15-B16)/B17
Two-Tail Test Lower Critical Value -1.9600=NORMSINV(B4/2)Upper Critical Value 1.9600=NORMSINV(1-B4/2)p-Value 0.2703=2*(1-NORMSDIST(ABS(B18)))
Do not reject the null hypothesis =IF(B23<$B$4,"Reject the null hypothesis",
Do not reject the null hypothesis)
Chap 12-64Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Example Minitab Output
Chap 12-64
DCOVAMann-Whitney Test and CI: Factory B, Factory A
N Median
Factory B 4 88.50
Factory A 5 82.00
Point estimate for ETA1-ETA2 is 6.50
96.3 Percent CI for ETA1-ETA2 is (-9.00,21.00)
W = 24.5
Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.3272
The test is significant at 0.3252 (adjusted for ties)
Chap 12-65Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-65
Kruskal-Wallis Rank Test
Tests the equality of more than 2 population medians
Use when the normality assumption for one-way 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
DCOVA
Chap 12-66Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-66
Kruskal-Wallis Test Procedure
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
DCOVA
Chap 12-67Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-67
Kruskal-Wallis Test Procedure
The Kruskal-Wallis H-test statistic: (with c – 1 degrees of freedom)
)1n(3n
T
)1n(n
12H
c
1j j
2j
where:n = sum of sample sizes in all groupsc = Number of groupsTj = Sum of ranks in the jth groupnj = Number of values in the jth group (j = 1, 2, … , c)
(continued)
DCOVA
Chap 12-68Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-68
Decision rule Reject H0 if test statistic H > 2
α
Otherwise do not reject H0
(continued)
Kruskal-Wallis Test Procedure
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
2
2α
0
Reject H0Do not reject H0
DCOVA
Chap 12-69Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-69
Do different departments have different class sizes?
Kruskal-Wallis Example
Class size (Math, M)
Class size (English, E)
Class size (Biology, B)
2345547866
5560724570
3040183444
DCOVA
Chap 12-70Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-70
Do different departments have different class sizes?
Kruskal-Wallis Example
Class size (Math, M)
Ranking Class size (English, E)
Ranking Class size (Biology, B)
Ranking
2341547866
269
1512
5560724570
101114 813
3040183444
35147
= 44 = 56 = 20
(continued)
DCOVA
Chap 12-71Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-71
The H statistic is
(continued)
Kruskal-Wallis Example
6.721)3(155
20
5
56
5
44
1)15(15
12
1)3(nn
T
1)n(n
12H
222
c
1j j
2j
equal are Medians population allNot :H
MedianMedianMedian :H
1
BEM0
DCOVA
Chap 12-72Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-72
Since H = 7.12 > ,
reject H0
(continued)
Kruskal-Wallis Example
5.991205.0 χ
Compare H = 7.12 to the critical value from the chi-square distribution for 3 – 1 = 2 degrees of freedom and = 0.05:
5.991χ 20.05
There is sufficient evidence to reject that the population medians are all equal
DCOVA
Chap 12-73Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Example Excel Output
Chap 12-73
DCOVA
Kruskal-Wallis Rank Test
CalculationsGroup Sample Size Sum of Ranks Mean Ranks
Data Supplier 1 5 44 8.8Level of Significance 0.05 Supplier 2 5 56 11.2
Supplier 3 5 20 4Intermediate Calculations
Sum of Squared Ranks/Sample Size 1094.4 =(G5*F5)+(G6*F6)+(G7*F7)Sum of Sample Sizes 15 =SUM(E5:E7)Number of Groups 3
Test Result H Test Statistic 6.7200 =(12/(B10*(B10+1)))*B9-(3*(B10+1))Critical Value 5.9915 =CHIINV(B6,B11-1)p-Value 0.0347 =CHIDIST(B14,B11-1)
Reject the null hypothesis =IF(B16<B6,"Reject the null hypothesis","Do not reject the null hypothesis")
Chap 12-74Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Example Minitab Output
Chap 12-74
DCOVAKruskal-Wallis Test: Class Size versus Class Type
Kruskal-Wallis Test on Class Size
Class Type N Median Ave Rank Z
B 5 34.00 3.8 -2.57
E 5 60.00 11.1 1.90
M 5 54.00 9.1 0.67
Overall 15 8.0
H = 7.11 DF = 2 P = 0.029
H = 7.13 DF = 2 P = 0.028 (adjusted for ties)
Chap 12-75Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-75
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
Chap 12-76Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-76
Chapter Summary
Examined how to use the Chi-Square to test for a variance or standard deviation
Used the Wilcoxon rank sum test for two population medians
Applied the Kruskal-Wallis rank H-test for multiple population medians
(continued)
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-77
On Line Topic
Wilcoxon Signed Ranks Test
Basic Business Statistics12th Edition
Chap 12-78Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Learning Objectives
In this topic, you learn:How to use the Wilcoxon signed ranks test for
comparing paired samples
Chap 12-79Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Wilcoxon Signed Ranks Test
A nonparametric test for two related populations Steps:
1. For each of n sample items, compute the difference, Di, between two measurements
2. Ignore + and – signs and find the absolute values, |Di|
3. Omit zero differences, so sample size is n’4. Assign ranks Ri from 1 to n’ (give average rank to
ties)
5. Reassign + and – signs to the ranks Ri
6. Compute the Wilcoxon test statistic W as the sum of the positive ranks
Chap 12-80Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Wilcoxon Signed Ranks Test Statistic
The Wilcoxon signed ranks test statistic is the sum of the positive ranks:
For small samples (n’ < 20), use Table E.9 for the critical value of W
n'
1i
)(iRW
Chap 12-81Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Wilcoxon Signed Ranks Test Statistic
For samples of n’ > 20, W is approximately normally distributed with
24
1)1)(2n'(n'n'σ
4
1)(n'n'μ
W
W
Chap 12-82Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Wilcoxon Signed Ranks Test
The large sample Wilcoxon signed ranks Z test statistic is
To test for no median difference in the paired values:
H0: MD = 0
H1: MD ≠ 0
24
1)1)(2n'(n'n'4
1)(n'n'W
ZSTAT
Chap 12-83Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Topic Summary
Used the Wilcoxon signed ranks test for comparing paired samples
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 12-84
On Line Topic
Friedman Rank Test
Basic Business Statistics12th Edition
Chap 12-85Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Learning Objectives
In this topic, you learn:How to use the Friedman rank test for comparing
multiple population medians in a randomized block design
Chap 12-86Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Friedman Rank Test
Use the Friedman rank test to determine whether c groups (i.e., treatment levels) have been selected from populations having equal medians
H0: M.1 = M.2 = . . . = M.c
H1: Not all M.j are equal (j = 1, 2, …, c)
Chap 12-87Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Friedman Rank Test
Friedman rank test for differences among c medians:
where = the square of the total ranks for group j
r = the number of blocks
c = the number of groups
(continued)
1)3r(cR1)rc(c
12F
c
1j
2.jR
2.jR
Chap 12-88Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Friedman Rank Test
The Friedman rank test statistic is approximated by a chi-square distribution with c – 1 d.f.
Reject H0 if
Otherwise do not reject H0
(continued)
2R
χFα
Chap 12-89Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Topic Summary
Applied the Friedman rank test for comparing multiple population medians in a randomized block design