Professional Documents
Culture Documents
5 Chi Square Tests
5 Chi Square Tests
all cells fe
• fo = observed frequency in a particular cell of contingency table.
• fe = expected frequency in a particular cell
• = [row total x column total]/ Grand Total
• c2 follows Chi-Square distribution with (r-1)(c-1) d.f.
• The test is considered as a right tailed test.
• We reject H0 in the favor of H1 at α x100% level, if
c2 (2 )
• Assumptions:
• Total sample size should be large. (at least 50)
• Each cell in the contingency table has expected frequency of at
least FIVE.
Object to Location
Record
Sharing NCR Bangalore Hyderabad Total
Yes f o f e 2 11 .571
f o f e 2 7.700
f o f e 2 0.3926
fe fe fe
No f o f e 2 f o f e 2 f o f e 2 0.888
26.159 17.409
fe fe fe
( f f ) 2
c2 o e
64.1196
all cells fe
=0.05
0
Do not Reject H0 2
reject H0
0.709 12.592
fo fe (fo –fe)2 / fe
• H0: No Difference 86 84 0.048
• H1: Difference 60 62 0.064
44 46 0.087
• Calculation for Chi – Square: 10 8 0.500
• α = 0.05 40 42 0.095
• d.f. = (2-1)(4-1) – 1 = 2 33 31 0.129
25 23
• Critical Value = 5.991 2 4
27 27 0
• Do not Reject H0 300 300 0.923
fe
fo fe (fo –fe)2 / fe
102 200 x 0.45 = 90 1.60
82 200 x 0.40 = 80 0.05
16 200 x 0.15 = 30 6.53
200 200 8.18
• α = 0.05
• d.f. = 3 – 1 = 2
• Critical Value = 5.991
• Reject H0
QAM – II by Gaurav Garg (IIM Lucknow)
• Example:
• Suppose a die is tossed 60 times.
• It is observed that
• 1 comes 8 times
• 2 comes 6 times
• 3 comes 12 times
• 4 comes 8 times
• 5 comes 12 times
• 6 comes 14 times
• If the die is fair, expected frequencies are 10, 10,
10, 10, 10, and 10.
• α = 0.05, d.f. = 6 – 1 = 5
• Critical Value = 11.070
• Do not reject H0 : Fit is good or die is fair.
QAM – II by Gaurav Garg (IIM Lucknow)
• Example:
• Following are the number of aircraft accidents
during the various days of the week. Find if the
accidents are uniformly distributed over the week.
Days: Mon Tue Wed Thu Fri Sat Sun
No. of Acc.: 14 16 8 12 11 9 14
• (= 4.17)
• α = 0.05, d.f. = 6 – 1 = 5
• Critical Value = 11.070
• Do not reject H0
QAM – II by Gaurav Garg (IIM Lucknow)
Goodness of Fit test for Normal Distribution
• In many statistical analyses, we assume that the data
has normal distribution.
• Using Chi-Square test, we can verify this.
• Example:
• We wish to examine if following data has normal
distribution:
5.65 5.44 5.42 5.40 5.53 5.34 5.54 5.45 5.52 5.41
5.57 5.40 5.53 5.54 5.55 5.62 5.56 5.46 5.44 5.51
5.47 5.40 5.47 5.61 5.53 5.32 5.67 5.29 5.49 5.55
5.77 5.57 5.42 5.58 5.58 5.50 5.32 5.50 5.53 5.58
5.61 5.45 5.44 5.25 5.56 5.63 5.50 5.57 5.67 5.36
QAM – II by Gaurav Garg (IIM Lucknow)
• We wish to examine if the given sample has N(μ,σ)
distribution.
• Sample mean ( x ) is the estimate of μ.
• Sample standard deviation (s1) is the estimate of σ.
• Now, arrange the given data in class intervals.
• Test Statistic: ( f f ) 2
c2 o e
fe
• fo = observed frequency of a particular class interval
• fe = expected frequency of that class interval
• = Total frequency x probability of that class interval
• c2 follows Chi-Square distribution with k-1-2 = k-3 d.f.
X ~ N ( x , s1 ) x 5.5014, s1 0.10583
Class Interval fo Probability fe (f0 - fe)2/fe
Below 5.40 9 P(X<5.40) = 0.1690 8.449827 0.035822
5.40 - 5.45 8 P(5.40<X<5.45) = 0.1446 7.229963 0.082014
5.45 – 5.50 7 P(5.45<X<5.50) = 0.1811 9.056342 0.466915
5.50 - 5.55 10 P(5.50<X<5.55) = 0.1822 9.112070 0.086525
5.55 - 5.60 8 P(5.55<X<5.60) = 0.1473 7.364258 0.054882
Above 5.60 8 P(X>5.60) = 0.1758 8.787539 0.070579
50 0.796737
• α = 0.05, d.f. = 6 – 1 – 2 = 3,
• Critical Chi Square = 7.815
• Computed Chi Square = 0.796737
• Do not reject H0
QAM – II by Gaurav Garg (IIM Lucknow)
Goodness of Fit test for Exponential Distribution
• Example:
• Among 100 vacuum tubes used in an experiment,
46 had a service life of less than 20 hours,
19 had a service life of 20 or more but less than 40 hours,
17 had a service life 40 hours or more but less than 60
hours,
12 had a service life of 60 hours or more but less than 80
hours,
6 had a service life of 80 hours or more.
• Test at 1% level of significance whether the lifetimes
may be regarded as a sample from an exponential
population with a mean of 40 hours.
QAM – II by Gaurav Garg (IIM Lucknow)
• A continuous random variable X is said to have Exponential
Distribution with mean 1/ if its probability density function
is given by e x , x 0, 0
f ( x)
0, otherwise
x
• Also, P ( X x ) 1 e
• We use above formula to obtain probabilities of class
intervals.
• This distribution depends on a single parameter = 1/ mean
• When is not given, it is estimated from the sample using
ˆ 1 / sample mean 1/ x
sample mean.
• MEAN = λ
• λ is not given.
• You can estimate it from the sample.
QAM – II by Gaurav Garg (IIM Lucknow)
Summary
• Contingency Table
• Chi Square test for differences in more than two
proportions
• Chi Square test for independence of attributes
• Chi Square test for Goodness of Fit
• Test Statistic:
( f f ) 2
c2 o e
fe
• Test Statistic follows Chi Square distribution with d.f.
Contingency Table: (No. of rows – 1) (No. of columns – 1)
Goodness of Fit: No. of Classes – 1 – No. of Estimates
If we pool some frequency, d.f. is reduced.
If we estimate some parameter, d.f is reduced.
QAM – II by Gaurav Garg (IIM Lucknow)