Sunteți pe pagina 1din 12

Chapter 6

Supplemental Materials on Critical


Regions and p-values with Skew
Distributions
6.1
6.1.1

Tests on Normal Variances


One-sample 2 test

The issue: Suppose that we want to test the null hypothesis H 0 : 2 = 02


against one of the alternatives H1 : 2 6= 02 , H2 : 2 > 02 , or H3 : 2 < 02
on the basis of a random sample X1 , . . . , Xn from N (, 2 ), where and 2
are unknown.
(a) The critical region approach

Step 1: To Find a Test Statistic. Note that the distribution of


2 =

(n 1)S 2
2

is 2 (n 1) that does not depend on the mean and the variance 2 . In


other words, 2 is a pivotal quantity. The test statistic is
21 =

2
(n 1)S 2
(n 1)S 2 2
2
=

.
2
2
2
0
0
02

When H0 is true, i.e., 2 = 02 , the test statistic is


21 = 2 2 (n 1).

(6.1)

142

6. Supplemental Materials on Critical Regions and p-values

Step 2: To Determine a Critical Region of Size . Since


= 1 + 2
= Pr{21 6 k1 } + Pr{21 > k2 },
=
=

Pr{21
Pr{21

for H1 ,

for H2 ,

for H3 ,

> (, n 1)},
6 (1 , n 1)},

(6.2)

where k1 = 2 (1 1 , n 1) and k2 = 2 (2 , n 1), the critical regions for


three alternatives H1 , H2 or H3 are given by
C1 = {x: 21, obs 6 k1
C2 = {x:
C3 = {x:

21, obs
21, obs

or

21, obs > k2 },

(6.3)

> (, n 1)},
6 2 (1 , n 1)},

where
21, obs =

(n 1)s2
,
02

(6.4)

denotes the observed value of the test statistic 21 .


Step 3: To Determine k1 and k2 . Almost all textbooks simply use an
equal-tail approach by letting 1 = 2 = /2 so that
k1 = 2 (1 /2, n 1)

and k2 = 2 (/2, n 1).

(6.5)

However, for non-symmetrical density like this one, the equal-tail approach
leading to the results in (6.5) is not the correct likelihood ratio test.
In the follows, we present a simple method for determine k 1 and k2 (see
Figure 6.1). We denote the density function of the 2 (n 1) by
gn1 (x) =

2(n1)/2 (n1)/21 x/2


e
,
x
((n 1)/2)

x > 0,

whose mode is n 3. The equal-height approach requires to determine k 1


and k2 satisfying (see Figure 6.1):
gn1 (k1 ) = gn1 (k2 ),
subject to k1 < n 3 < k2 . Note that
k1 = 2 (1 1 , n 1)
2

k2 = (2 , n 1).

and

143

6.1 Tests on Normal Variances

1 gn1 (k1 )
k1

gn1 (k2 ) 2
k2

Figure 6.1 The critical region C1 defined by (6.3) for a two-tailed 2 test, where
gn1 () denotes the density function of the 2 (n 1), and 1 + 2 = .

That is, finding k1 and k2 is equivalent to finding 1 and 2 . Since 2 =


1 , we only need to find 1 , which satisfies the following equation:
gn1 (2 (1 1 , n 1)) = gn1 (2 ( 1 , n 1)).

(6.6)

Especially, when gn1 () is skew toward the left, we always have 0 < 1 <
/2. Thus, we can use the grid method or the bisection method to find 1 .
function(n, alone)
{
# Function name: Compute.alpha.one.chisq.test(n, alone)
# n is the sample size
# alone is a vector consisting of the grid points
# over the interval [0.001, 0.025], e.g.,
# alone = seq(0.025, 0.001, -0.0001)
v <- n - 1
al <- 0.05
L <- length(alone)
k1 <- qchisq(alone, v)
k2 <- qchisq(1 - al + alone, v)

144

6. Supplemental Materials on Critical Regions and p-values


gk1 <- dchisq(k1, v)
gk2 <- dchisq(k2, v)
error <- abs(gk1 - gk2)
result <- matrix(c(alone, k1, k2, gk1, gk2, error), L, 6)
return(result)

}
Example 6.1 Let X1 , . . . , Xn be a random sample from N (, 2 ), and
we observed n = 25 and s2 = 1600. Test H0 : 2 = 02 = 900 against H1 :
2 6= 02 at the 0.05 level of significance.
Solution.
1

Since = 0.05, from Table 6.1, we have 1 = 0.0138, k1 = 11.361 and


k2 = 37.817. In this example, the mode of the density of 2 (n 1) is
n 3 = 22.
Table 6.1 Calculation of 1 from (6.6)
1
0.0250
0.0230
0.0210
0.0190
0.0170
0.0150
0.0140
0.0138

k1
12.4012
12.2454
12.0793
11.9010
11.7082
11.4974
11.3840
11.3610

k2
39.364
39.047
38.751
38.472
38.209
37.960
37.840
37.817

gn1 (k1 )
0.01323
0.01244
0.01164
0.01080
0.00994
0.00904
0.00858
0.00849

gn1 (k2 )
0.00609
0.00653
0.00696
0.00739
0.00782
0.00824
0.00845
0.00849

Error
0.0071416
0.0059176
0.0046744
0.0034095
0.0021199
0.0008017
0.0001305
4.7961 10 6

NOTE: Error = |gn1 (k1 ) gn1 (k2 )|.

Reject the H0 if 21, obs 6 11.361 or 21, obs > 37.817, where 21, obs is
defined by (6.4).

Calculate 21, obs = 42.667.

Since 21, obs = 42.667 > 37.817, the null hypothesis is rejected.

(b) The p-value approach

145

6.1 Tests on Normal Variances


The corresponding p-values can be calculated by
p-value = p1 + p2
= Pr{21 6 b1 } + Pr{21 > b2 },
p-value = Pr{21 > 21, obs },
p-value =

Pr{21

21, obs },

for H1 ,

(6.7)

for H2 ,
for H3 ,

where p1 , p2 , b1 and b2 are shown in Figure 6.2, 21 is specified by (6.1) and


21, obs given by (6.4) denotes the observed value of the test statistic 21 . To
calculate the two-tailed p-value defined by (6.7), we consider two cases.
Case I: 21, obs < n 3. In this case, we define b1 = 21, obs as shown in
Figure 6.2(i). The value of b2 can be obtained by solving
gn1 (b2 ) = gn1 (b1 )

subject to b2 > n 3.

(6.8)

Case II: 21, obs > n 3. In this case, we define b2 = 21, obs as shown in
Figure 6.2(ii). The value of b1 can be determined by
gn1 (b1 ) = gn1 (b2 )

subject to 0 < b1 < n 3.

(6.9)

Example 6.1 (Revisited). Note that n = 25 and 21, obs = 42.667 > 22 =
n 3, then b2 = 21, obs = 42.667, gn1 (b2 ) = g24 (42.667) = 0.0028345. Now
(6.9) becomes g24 (b1 ) = 0.0028345.
Table 6.2 Calculation of b1 from g24 (b1 ) = 0.0028345
b1
11
10
9.9
9.8
9.7

|g24 (b1 ) 0.0028345|


4.2971 103
1.2866 103
1.0444 103
8.1244 104
5.9038 104

b1
9.6
9.5
9.4
9.41
9.4095

|g24 (b1 ) 0.0028345|


3.7808 104
1.7535 104
1.8020 105
9.0208 107
4.6199 108

From Table 6.2, we obtain b1 = 9.4095 < 22. From (6.7),


p-value = p1 + p2
= Pr{2 (n 1) 6 b1 } + Pr{2 (n 1) > b2 }
= Pr{2 (24) 6 9.4095} + Pr{2 (24) > 42.667}
= 0.0034162 + 0.010854 = 0.01427 < 0.05
so that the H0 must be rejected.

146

6. Supplemental Materials on Critical Regions and p-values


(i) 21, obs < n 3

p1 gn1 (b1 )

gn1 (b2 ) p2

b1 = 21, obs

b2

(ii) 21, obs > n 3

p1 gn1 (b1 )
b1

gn1 (b2 ) p2
b2 = 21, obs

Figure 6.2 The p-value defined by (6.7) for a two-tailed 2 test, where gn1 ()
denotes the density of the 2 (n 1) with mode n 3. (i) 21, obs given by (6.4) is
at the left tail; (ii) 21, obs is at the right tail .

147

6.1 Tests on Normal Variances

6.1.2

Two-sample F test

The issue: Suppose that we want to test the null hypothesis H 0 : 12 = 22


against one of the alternatives H1 : 12 6= 22 , H2 : 12 > 22 , or H3 : 12 < 22
iid

on the basis of two independent random samples X i1 , . . . , Xini N (i , i2 ),


where i and i2 are unknown, i = 1, 2.
(a) The critical region approach

Step 1: To Find a Test Statistic. Define i = ni 1, i = 1, 2. Note


that the distribution of
2 S 2
F = 22 12
1 S2
is F (1 , 2 ) that does not depend on the means i and the variances i2 . In
other words, F is a pivotal quantity. The test statistic is
F0 =

S12
22 S12 12
12
=

=
F

.
S22
12 S22 22
22

When H0 is true, i.e., 12 = 22 , the test statistic is


F0 = F F (1 , 2 ).

(6.10)

Step 2: To Determine a Critical Region of Size . Since


= 1 + 2
= Pr{F0 6 k1 } + Pr{F0 > k2 },

for H1 ,

= Pr{F0 > f (, 1 , 2 )},

for H2 ,

= Pr{F0 6 f (1 , 1 , 2 )},

for H3 ,

(6.11)

where k1 = f (1 1 , 1 , 2 ) and k2 = f (2 , 1 , 2 ), the critical regions for


three alternatives H1 , H2 or H3 are given by
C1 = {x: f0 6 k1

or

f0 > k2 },

(6.12)

C2 = {x: f0 > f (, 1 , 2 )},


C3 = {x: f0 6 f (1 , 1 , 2 )},
where the observed value of the test statistic F 0 is denoted by
f0 = s21 /s22 .

(6.13)

148

6. Supplemental Materials on Critical Regions and p-values

Step 3: To Determine k1 and k2 . Almost all textbooks simply use an


equal-tail approach by letting 1 = 2 = /2 so that
k1 = f (1 /2, 1 , 2 )

and k2 = f (/2, 1 , 2 ).

(6.14)

However, for non-symmetrical density like this one, the equal-tail approach
leading to the results in (6.14) is not the correct likelihood ratio test.
In the follows, we present a simple method for determine k 1 and k2 (see
Figure 6.3). We denote the density function of the F ( 1 , 2 ) by
2
( 1 +
2 )
h1 ,2 (x) =
( 21 )( 22 )

1
2

 1
2

1
2

1 x
1+
2

 1 +2
2

x > 0,

1 2)2
whose mode is (
1 (2 +2) . The equal-height approach requires to determine
k1 and k2 satisfying (see Figure 6.3):

h1 ,2 (k1 ) = h1 ,2 (k2 )
subject to k1 <

(1 2)2
1 (2 +2)

< k2 . Note that

k1 = f (1 1 , 1 , 2 )

and

k2 = f (2 , 1 , 2 ).
That is, finding k1 and k2 is equivalent to finding 1 and 2 . Since 2 =
1 , we only need to find 1 , which satisfies the following equation:
h1 ,2 (f (1 1 , 1 , 2 )) = h1 ,2 (f ( 1 , 1 , 2 )).

(6.15)

Especially, when h1 ,2 () is skew toward the left, we always have 0 < 1 <
/2. Thus, we can use the grid method or the bisection method to find 1 .
function(n1, n2, alone)
{
# Function name: Compute.alpha.one.F.test(n1, n2, alone)
# n1 and n2 are the sample sizes of the two samples
# alone is a vector consisting of the grid points
# over the interval [0.0001, 0.025], e.g.,
# seq(0.025, 0.001, -0.0001)
v1 <- n1 - 1
v2 <- n2 - 1

149

6.1 Tests on Normal Variances

al <- 0.05
L <- length(alone)
k1 <- qf(alone, v1, v2)
k2 <- qf(1 - al + alone, v1, v2)
hk1 <- df(k1, v1, v2)
hk2 <- df(k2, v1, v2)
error <- abs(hk1 - hk2)
result <- matrix(c(alone, k1, k2, hk1, hk2, error), L, 6)
return(result)
}
Example 6.2 Let Xi1 , . . . , Xini be two independent random samples from
N (i , i2 ), i = 1, 2, and we observed n1 = 13, s21 = 37853.17, n2 = 7,
s22 = 15037.00. Test H0 : 12 = 22 against H1 : 12 6= 22 at = 0.05.
Solution.
1

Since = 0.05, from Table 6.3, we have 1 = 0.000657, k1 = 0.10889


and k2 = 4.0233. In this example, the mode of the density of F (12, 6)
1 2)2
is (
1 (2 +2) = 0.625.
Table 6.3 Calculation of 1 from (6.15)
1
0.025
0.015
0.005
0.0005
0.0006
0.00065
0.000657

k1
0.26822
0.23158
0.17370
0.10269
0.10678
0.10864
0.10889

k2
h1 ,2 (k1 )
5.3662 0.31283
4.6648 0.23300
4.1885 0.11615
4.0176 0.02286
4.0212 0.02614
4.0230 0.02772
4.0233 0.02794

h1 ,2 (k2 )
Error
0.011359
0.30147
0.017738
0.21526
0.024730
0.09142
0.028046
0.00518
0.027971
0.00182
0.027934
0.00021
0.027928 1.4163 10 5

NOTE: Error = |h1 ,2 (k1 ) h1 ,2 (k2 )|.

Reject the H0 if f0 6 0.10889 or f0 > 4.0233, where f0 is defined by


(6.13).

Calculate f0 = 2.5173.

Since f0 = 2.5173 (0.10889, 4.0233), we accept the H 0 .

150

6. Supplemental Materials on Critical Regions and p-values

1 h1, 2 (k1 )

h1, 2 (k2 ) 2

k1

k2

Figure 6.3 The critical region C1 defined by (6.12) for a two-tailed F test, where
h1 ,2 () denotes the density function of the F (1 , 2 ), and 1 + 2 = .
(b) The p-value approach

The corresponding p-values can be calculated by


p-value = p1 + p2
= Pr{F0 6 b1 } + Pr{F0 > b2 },

for H1 ,

p-value = Pr{F0 > f0 },

for H2 ,

p-value = Pr{F0 6 f0 },

for H3 ,

(6.16)

where p1 , p2 , b1 and b2 are shown in Figure 6.4, F0 is specified by (6.10)


and f0 given by (6.13) denotes the observed value of the test statistic F 0 .
To calculate the two-tailed p-value defined by (6.16), we consider two cases.
Case I: f0 is at the left tail. The value of b2 at the right tail can be
obtained by solving (see Figure 6.4(i))
h1 ,2 (b2 ) = h1 ,2 (f0 )

subject to

b2 >

(1 2)2
.
1 (2 + 2)

(6.17)

Case II: f0 is at the right tail. The value of b1 at the left tail can be
determined by (see Figure 6.4(ii))
h1 ,2 (b1 ) = h1 ,2 (f0 )

subject to

0 < b2 <

(1 2)2
.
1 (2 + 2)

(6.18)

151

6.1 Tests on Normal Variances


(i) f0 is at the left tail

p1 h1, 2 (f0 )
f0

h1, 2 (b2 ) p2
b2
(ii) f0 is at the right tail

p1 h1, 2 (b1 )
b1

h1, 2 (f0 ) p2
f0

Figure 6.4 The p-value defined by (6.16) for a two-tailed F test, where h1, 2 ()
2
denotes the density of the F (1 , 2 ) with mode (11(2)
. (i) f0 given by (6.13) is
2 +2)
at the left tail; (ii) f0 is at the right tail .

152

6. Supplemental Materials on Critical Regions and p-values

Example 6.2 (Revisited). Note that n 1 = 13, n2 = 7 and f0 = 2.5173 >


0.625 = mode, then h1 ,2 (f0 ) = h12,6 (2.5173) = 0.10241. Now (6.18) becomes h1 ,2 (b1 ) = 0.10241.
Table 6.4 Calculation of b1 from h1 ,2 (b1 ) = 0.10241
b1
0.625
0.325
0.200
0.190
0.180

|h1 ,2 (b1 ) 0.10241|


0.59141
0.32767
0.06411
0.04426
0.02523

b1
0.170
0.168
0.166
0.1659
0.1658

|h1 ,2 (b1 ) 0.10241|


0.007185
0.003705
0.000271
1.0091 104
6.9435 105

From Table 6.4, we obtain b1 = 0.1658 < 0.625. From (6.16),


p-value = p1 + p2
= Pr{F0 6 b1 } + Pr{F0 > b2 }
= Pr{F0 6 b1 } + Pr{F0 > f0 }
= Pr{F (12, 6) 6 0.1658} + Pr{F (12, 6) > 2.5173}
= 0.0041373 + 1 0.86694 = 0.1372 > 0.05
so that the H0 cannot be rejected.

S-ar putea să vă placă și