Map of the Website http://www.econ.uiuc.edu/ECON173

Download Report

Transcript Map of the Website http://www.econ.uiuc.edu/ECON173

HYPOTHESIS TESTING:
ABOUT MORE THAN TWO (K)
INDEPENDENT POPULATIONS
1
ONE-WAY ANALYSIS OF VARIANCE (ANOVA)
Analysis of variance is used for two different purposes:
1. To estimate and test hypotheses about population
variances
2. To estimate and test hypotheses about population
means
We are concerned here with the latter use.
2
Assumptions:
•We have K independent samples, one from each of K
populations.
•Each population has a normal distribution with unknown
mean i
•All of the populations have the same standard deviation
 (unknown)
H0: 1=  2= 3=...= k
Ha: Not all the i are equal.
3
1
x11
x21
x31
Treatment
2
3

x12 x13 
x22 x23 
x32 x33
k
x1k
x2k
x3k




T.1
x .1
T.2
x .2
T.3
x .3

x n11 x n2 2 x n3 3  x nk k
Total
Mean
T.k
x.k
T..
x..
nj
T. j   xij  total of the jth column
i 1
x. j 
T. j
nj
k
 mean of the jth column
k nj
T..   T. j    xij  total of the all observatio ns
T..
x.. 
N
k
N  nj
j 1
4
The Total Sum of Squares
2
T
SST   ( xij  x.. ) 2   xij2  ..
N
j 1 i 1
j 1 i 1
k nj
k nj
SST=SSA+SSW
The Within Groups Sum of Squares
k nj
k nj
T
j 1
nj
SSW    ( xij  x. j )    x  
2
j 1 i 1
j 1 i 1
2
ij
2
.j
k
The Among Groups Sum of Squares
k
k
T. j
j 1
nj
SSA   n j ( x. j  x.. )  
j 1
2
T / N
2
..
5
Among groups mean square
MSA  SSA /( k  1)
Within groups mean square
MSW  SSW /( N  k )
Variance Ratio (F)
VR  MSA / MSW
6
ANOVA TABLE
Source
SS
df
MS
Among samples SSA
k-1
MSA
Within samples
SSW
N-k
MSW
Total
SST
N-1
F
(VR)
MSA/MSW
7
Testing for Significant Differences Between Individual
Pairs of Means
Whenever the analysis of variance leads to a rejection of
the null hypothesis of no difference among population
means, the question naturally arise regarding just which
pairs of means are different. Over the years several
procedures for making individual comparisons have been
suggested.
LSD (Least Significant Difference )
Sidak
Tukey
Dunnett’s C
Dunnett’s T3
Bonferroni
The oldest procedure, and perhaps the one most widely
used in the past, is the Least Significant Difference
(LSD) procedure.
8
Least Significant Difference (LSD)
When sample sizes are equal (n1=n2=n3=...=nk=n)
2( MSW )
xi  x j  t
n
p<0.05
When sample sizes are not equal (n1n2  n3 ...  nk)
1 1
xi  x j  t MSW (  )
ni n j
p<0.05
9
Example In a study of the effect of glucose on insulin
release,
specimens
of
pancreatictissue
from
experimental animals were randomly assigned to be
treated with one of five different stimulants. Later, a
determination was made on the amount of insulin
released. The experimenters wished to know if they
could conclude that there is a difference among the five
treatments with respect to the mean amount of insulin
released. The resulting measurements of amount of
insulin released following treatment are displayed in the
table.
The five sets of observed data constitute five
independent samples from the respective populations.
Each of the populations from which he samples come
is normally distributed with mean,i, and variances i2.
Each population has the same variance.
10
1
1.53
1.61
3.75
2.89
3.26
Stimulant
2
3
4
3.15 3.89 8.18
3.96 3.68 5.64
3.59 5.70 7.36
1.89 5.62 5.33
1.45 5.79 8.82
1.56 5.33 5.26
7.10
5
5.86
5.46
5.69
6.49
7.81
9.03
7.49
8.98
Total 13.04 15.60 30.01 47.69 56.81 163.15
Mean 2.61 2.60 5.00 6.81 7.10
5.10
11
H0: 1=  2= 3= 4 = 5
Ha: Not all the i are equal.
2
2
k n
T
163
.
15
SST    xij2  ..  1.53 2  1.612    8.98 2 
N
32
j 1 i 1
266117.923
 994.3529 
32
 162.54282
j
k nj
k
T. 2j
j 1 i 1
j 1
nj
SSW    xij2  
2
2
2
2
2


13
.
04
15
.
60
30
.
01
47
.
69
56
.
81
2
2
2
 1.53  1.61    8.98  





5
6
6
7
8


 41.35739
SSA=SST-SSW=162.54282-41.35739=121.18543
12
MSW=SSW/27=41.357/27=1.532
MSA=SSA/(5-1)=121.185/4=30.296
F=MSA/MSW=30.296/1.532=19.779
ANOVA TABLE
Between Groups
Within Groups
Total
Sum of
Squares
121,185
41,357
162,543
df
4
27
31
Mean Square
30,296
1,532
F
19,779
Sig.
,000
We conclude that not all population means are equal.
13
Since n1n2  n3 n4  n5), reject H0 if
1 1
xi  x j  t MSW (  )
n1 n2
2.61  2.60
Hypothesis
LSD
Statistical
Decision
H0: 1= 2
1 1
2.05 1.532(  )  1.538
5 6
1 1
2.05 1.532(  )  1.538
5 6
0.01<1.538,
accept H0.
H0: 1= 3

H0: 4= 5

1 1
2.05 1.532(  )  1.314
7 8
2.391.538,
reject H0.

0.29<1.314,
accept H0.
14
Multiple Comparisons
(I) Stimulant
1,00
2,00
3,00
4,00
5,00
(J) Stimulant
2,00
Mean
Difference
(I-J)
8,000E-03
LSD
95% Confidence Interval
Std. Error
,7494
Sig.
,992
Lower Bound
-1,5297
Upper Bound
1,5457
3,00
-2,3937 *
,7494
,004
-3,9314
-,8560
4,00
-4,2049 *
,7247
,000
-5,6918
-2,7179
5,00
-4,4933 *
,7056
,000
-5,9409
-3,0456
,7494
,992
-1,5457
1,5297
1,00
-8,0000E-03
3,00
-2,4017 *
,7146
,002
-3,8678
-,9355
4,00
-4,2129 *
,6886
,000
-5,6257
-2,8000
5,00
-4,5013 *
,6684
,000
-5,8727
-3,1298
1,00
2,3937 *
,7494
,004
,8560
3,9314
2,00
2,4017 *
,7146
,002
,9355
3,8678
4,00
-1,8112 *
,6886
,014
-3,2240
-,3984
5,00
-2,0996 *
,6684
,004
-3,4710
-,7281
1,00
4,2049 *
,7247
,000
2,7179
5,6918
2,00
4,2129 *
,6886
,000
2,8000
5,6257
3,00
1,8112 *
,6886
,014
,3984
3,2240
5,00
-,2884
,6405
,656
-1,6027
1,0259
1,00
4,4933 *
,7056
,000
3,0456
5,9409
2,00
4,5013 *
,6684
,000
3,1298
5,8727
3,00
2,0996 *
,6684
,004
,7281
3,4710
4,00
,2884
,6405
,656
-1,0259
1,6027
*. The mean difference is significant at the .05 level.
15
16
KRUSKAL- WALLIS ONE-WAY ANOVA
When the assumptions underlying One-way ANOVA are
not met, that is, when the populations from which the
samples are drawn are not normally distributed with
equal variances, or when the data for analysis consist
only of ranks, a nonparametric alternative to the oneway analysis of variance may be used to test the
hypothesis of equal location parameters.
17
The application of the test involves the following steps:
1. The n1, n2, ..., nk observations from the k groups are
combined into a single series of size n and arranged in
order of magnitude from smallest to largest. The
observations are then replaced by ranks.
2. The ranks assigned to observations in each of the k
groups are added separately to give k rank sums.
3. The test statistic
# of groups
R 2j
12
KW 
  3(n  1)
n(n  1) j 1 n j
k
is computed.
Sum of ranks in jth
group
# of obs. in jth group
18
4. When there are three groups and five and fewer
observations in each group, the significance of the
computed KW is determined by using special tables.
When there are more than five observations in one or
more of the groups, KW is compared with the tabulated
values of 2 with k-1 df.
19
Determing which groups are significantly different
Like the one-way ANOVA, the Kruskal-Wallis test is an
overall test of significant result, the test does not indicate
where the differences are among the groups. To
determine which groups are significantly different from
one another, it is necessary to undertake multiple
comparisons.
n(n  1) n  1  KW  1 1 
Ri  R j  t

12
n  k  ni n j 
 p<0.05
20
Example The effect of two drugs on reaction time to a
certain stimulus were studied in three groups of
experimental animals. Group III served as a control while
the animals in group I treated with drug A and those in
group II were treated with drug B prior to the application
of the stimulus. Table shows the reaction times in
seconds of 13 animals. Can we conclude that the three
populations represented by the three samples differ with
respect to reaction time?
H0: The population distributions are all identical.
Ha: At least one of the populations tends to exhibit larger
values than at least one of the other populations.
21
Group
I
Rank II
Rank III
17
9 8
6.5 2
20
10 7
5 5
40
13 9
8 4
31
11 8
6.5 3
35
12
Ri
55
R 2j
12
KW 
  3(n  1)
n(n  1) j 1 n j
Rank
2
2
2


12
55
26
10
1 




13(13  1)  5
4
4 
4
 3(13  1)
3  10.68
k
2
KW(5,4,4;0.05)=5.617<KWcal
p<0.05, reject H0.
26
10
22
Multiple Comparisons Table
Groups R  R
i
j
n(n  1) n  1  KW  1 1 
t


12
n  k  ni n j 
Statistical
Decision
1-2
4.5
2.115
p<0.05
1-3
8.5
2.115
p<0.05
2-3
4
2.229
p<0.05
23
rxc Chi Square Test
We can use the chi-square test to compare
frequencies or proportions in two or more groups. The
classification according to two criteria, of a set of
entities, can be shown by a table in which the r rows
represents the various levels of one criterion of
classification and c columns represent the various
levels of the second criterion. Such a table is
generally called a contingency table.
We will be interested in testing the null hypothesis that
in the population the two criteria of classification are
independent or associated.
24
Second
Criteria
First Criteria
1
2

c
Total
1
O11
O12
O1c
O1.
2
O21
O22


O2c
O2.





r
Or1
Or2
Orc
Or.
Total
O.1
O.2



O.c
N
25
r
c
χ  
2
(O ij  E ij ) 2
i 1 j1
E ij
E ij 
O i.O .j
N
df = (r-1)(c-1)
No more than 20% of the cells should have expected
frequencies of less than 5.
26
Example A research team studying the relationship between
blood type and severity of a certain condition in a population
collected data on 1500 subjects as displayed in the below
contingency table. The researchers wished to know if these
data were compatible with the hypothesis that severity of
condition and blood type are independent.
Severity of
Condition
Blood Type
A
B
AB
0
Total
Absent
543
211
90
476
1320
Mild
44
22
8
31
105
Severe
28
9
7
31
75
Total
615
242
105
538
1500
27
Blood Type
Absent
Severity of condition
Count
Expected Count
% within severity
Mild
Count
Expected Count
% within severity
Severe
Count
Expected Count
% within severity
Total
Count
Expected Count
% within severity
A
543
B
211
AB
90
O
476
Total
1320
541,2
213,0
92,4
473,4
1320,0
41,1%
16,0%
6,8%
36,1%
100,0%
44
22
8
31
105
43,1
16,9
7,4
37,7
105,0
41,9%
21,0%
7,6%
29,5%
100,0%
28
9
7
31
75
30,8
12,1
5,3
26,9
75,0
37,3%
12,0%
9,3%
41,3%
100,0%
615
242
105
538
1500
615,0
242,0
105,0
538,0
1500,0
41,0%
16,1%
7,0%
35,9%
100,0%
0 cells (,0%) have expected count less than 5. The minimum
expected count is 5,25.
28
H0: severity of condition and blood type are independent.
Ha: severity of condition and blood type are not independent.
r
c
χ2  
i 1 j1
(O ij  E ij ) 2
E ij
(543  541.2) 2 (211  212.96) 2
(31  26.9) 2



541.2
212.96
26.9
 5.12
2(6,0.05)=12.592> 2(calculated), accept H0, p>0.05
We conclude that these data are compatible with the
hypothesis that severity of the condition and blood type
are independent.
29
When the sample size is small and assumption about
expected frequencies is not met;
Severity of condition
Total
Blood Type
A
Count
AbsentExpected Count
Count
Mild Expected Count
Severe Count
Expected Count
Count
Expected Count
B
50
50,0
15
14,5
4
4,4
69
69,0
AB
20
22,5
8
6,5
3
2,0
31
31,0
9
9,4
3
2,7
1
,8
13
13,0
O
45
42,1
10
12,2
3
3,7
58
58,0
Total
124
124,0
36
36,0
11
11,0
171
171,0
We
decide to
merge
two
conditions
C h i- Sq u ar e T es ts
Value
Pearson Chi-Square
1,998 a
Asymp. Sig.
(2-sided)
df
6
,920
N of Valid Cases
171
a. 5 cells (41,7%) have expected count less than 5. The
minimum expected count is ,84.
Assumption is violated
30
Blood Type
Severity of condition
Absent
A
Count
Expected Count
Present Count
Expected Count
Total
Count
Expected Count
B
AB
Total
O
50
20
9
45
124
50,0
22,5
9,4
42,1
124,0
19
11
4
13
47
19,0
8,5
3,6
15,9
47,0
69
31
13
58
171
69,0
31,0
13,0
58,0
171,0
C h i- Sq u ar e T es ts
Value
df
Asymp. Sig.
(2-sided)
Pearson Chi-Square
1,814 a
3
,612
a. 1 cells (12,5%) have expected count less than 5. The
minimum expected count is 3,57.
After combining mild and severe groups in one group, no
more than 20% of the cells have expected frequencies
less than 5.
31
If null hypothesis is rejected, how can we find the group which is
different?
A
AB
B
O
Total
Blood Type
Count
Expected Count
% within Tromboembolism
Count
Expected Count
% within Tromboembolism
Count
Expected Count
% within Tromboembolism
Count
Expected Count
% within Tromboembolism
Count
Expected Count
% within Tromboembolism
Tromboembolism
+
32
51
22,8
60,2
58,2%
35,2%
4
8
3,3
8,7
7,3%
5,5%
8
19
7,4
19,6
14,5%
13,1%
11
67
21,5
56,6
20,0%
46,2%
55
145
55,0
145,0
100,0%
100,0%
Asymp. Sig.
(2-sided)
,006
Value
df
Chi-Square
12,375a
3
N of Valid Cases
200
a. 1 cells (12,5%) have expected count less than 5. The
minimum expected count is 3,30.
Total
83
83,0
41,5%
12
12,0
6,0%
27
27,0
13,5%
78
78,0
39,0%
200
200,0
100,0%
2=5,118261
2=0,204807
2=0,067016
2=7,038861
Exclude Type O
from the
analysis
Reject H0. Which type of
blood group(s) is/are
different from the others
32
Count
A
AB
B
Total
Pearson Chi-Square
Tromboembosim
+
32
4
8
44
Value
,747a
Total
51
8
19
78
df
2
83
12
27
122
Asymp. Sig.
(2-sided)
,688
p>0.05
a. 1 cells (16,7%) have expected count less than 5. The
minimum expected count is 4,33.
Except for blood type O, distribution of
tromboembolism is similar within the others.
33