Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1
4.7. Chi-Square Tests 285

to rejectH 0 ifQk− 1 ≥c. To determine a test with level of significanceα,we
can use tables of theχ^2 -distribution or a computer package. Using R, we compute
the critical valuecbyqchisq( 1 −α,k-1). If, then, the hypothesisH 0 is rejected
when the observed value ofQk− 1 is at least as great asc,thetestofH 0 has a
significance level that is approximately equal toα.Alsoifqis the realized value of
the test statisticQk− 1 then the observed significance level of the test is computed
in R by1-pchisq(q,k-1).Thisisfrequentlycalledagoodness-of-fit test.Some
illustrative examples follow.


Example 4.7.1.One of the first six positive integers is to be chosen by a random
experiment (perhaps by the cast of a die). LetAi={x:x=i},i=1, 2 ,...,6. The
hypothesisH 0 :P(Ai)=pi 0 =^16 ,i=1, 2 ,...,6, is tested, at the approximate 5%
significance level, against all alternatives. To make the test, the random experiment
is repeated under the same conditions, 60 independent times. In this example,k=6
andnpi 0 = 60(^16 )=10,i=1, 2 ,...,6. LetXidenote the frequency with which
the random experiment terminates with the outcome inAi,i=1, 2 ,...,6, and let
Q 5 =


∑ 6
1 (Xi−10)

(^2) /10. Since there are 6−1 = 5 degrees of freedom, the critical
value for a levelα=0.05 test isqchisq(0.95,5) = 11.0705. Now suppose that
the experimental frequencies ofA 1 ,A 2 ,...,A 6 are, respectively, 13, 19, 11, 8, 5, and



  1. The observed value ofQ 5 is


(13−10)^2
10

+

(19−10)^2
10

+

(11−10)^2
10

+

(8−10)^2
10

+

(5−10)^2
10

+

(4−10)^2
10

=15. 6.

Since 15. 6 > 11 .0705, the hypothesisP(Ai)=^16 ,i=1, 2 ,...,6, is rejected at the
(approximate) 5% significance level.
The following R segment computes this test, returning the test statistic and the
p-value as shown:
ps=rep(1/6,6); x=c(13,19,11,8,5,4); chisq.test(x,p=ps)
X-squared = 15.6, df = 5, p-value = 0.008084.


Example 4.7.2.A point is to be selected from the unit interval{x:0<x< 1 }
by a random process. LetA 1 ={x:0<x≤^14 },A 2 ={x:^14 <x≤^12 },A 3 =
{x:^12 <x≤^34 },andA 4 ={x:^34 <x< 1 }. Let the probabilitiespi,i=1, 2 , 3 ,4,
assigned to these sets under the hypothesis be determined by the pdf 2x, 0 <x<1,
zero elsewhere. Then these probabilities are, respectively,


p 10 =

∫ 1 / 4

0

2 xdx= 161 ,p 20 = 163 ,p 30 = 165 ,p 40 = 167.

Thus the hypothesis to be tested is thatp 1 ,p 2 ,p 3 ,andp 4 =1−p 1 −p 2 −p 3 have
the preceding values in a multinomial distribution withk= 4. This hypothesis is
to be tested at an approximate 0.025 significance level by repeating the random
experimentn= 80 independent times under the same conditions. Here thenpi 0 for
i=1, 2 , 3 ,4, are, respectively, 5, 15, 25, and 35. Suppose the observed frequencies
ofA 1 ,A 2 ,A 3 ,andA 4 are 6, 18, 20, and 36, respectively. Then the observed value

Free download pdf