Professional Documents
Culture Documents
1. Introduction
2. Element of a Statistical Test
3. Tests for single population mean and single
population proportion
4. Tests for the differences between two population
means and between two population proportions
5. The relationship between hypothesis-testing and
confidence intervals
6. Test for single variance, and for comparing two
variances
Statistical Inference
Testing Hypotheses
A test of significance is a procedure for
evaluating the strength of the evidence
provided by the data against an hypothesis.
Terminology
Key words:
- Null Hypothesis Ho
- Alternative Hypothesis Ha
-Test Statistic and its distribution
- Rejection Region
- Type I error and II errors
- one-sided and two-sided tests
-Test Statistic
A test statistic is the function of sample data on which
a conclusion to reject or fail to reject Ho is based.
- Rejection Region (RR)
RR is the region contains all values of the test statistic
for which the null hypothesis is to be rejected in favor
of the alternative hypothesis. If for a particular sample
the computed value of the test statistic falls in RR, we
reject Ho; otherwise, we fail to reject Ho.
-Type I error and Type II error
The error of rejecting Ho when Ho is true is called
Type I error.
The error of failing to reject Ho when Ho is false is
called Type II error.
Main Components
in a Hypothesis Testing Procedure
1. Compose the null and alternative hypothesis:
2. Specify the test statistic
3. Compute the value of test statistic for the particular
sample(s) given
4. Under a confidence level , determine RR
5. Make conclusion
= some value
= 0
x 0
Test statistic: z = / n
Steps in a Hypothesis-Testing:
1. Describe the population characteristic of interest.
2. State the null hypothesis, Ho, and the alternative hypothesis,
Ha.
3. Select the significance level .
4. Check the assumptions required for the test.
5. Compute the value of the test statistic w, using the given
sample.
6. Determine the RR.
7. State the conclusion (which will be to reject the Ho if w
belongs to RR and not to reject Ho otherwise).
*
x
z=
/ n
has approximately a standard normal distribution.
2.
x
t=
s/ n
has approximately a t distribution with df=n-1.
= 0
t=
x 0
s/ n
Test statistic:
(a) If Ha: > 0, then we reject Ho if t > t(n-1,);
(b) If Ha: < 0 , then we reject Ho if t < -t(n-1,);
(c) If Ha: 0 , then we reject Ho if |t| > t(n-1,/2).
using t
(a) The following are the weight gains (lbs) of six young
lambs of the same breed who had been raised on the same
2
x
diet: 8, 7, 3, 9, 2, 4 ( x = 33,
= 223).
(b) Is the true mean weight gain more than 3.5 lbs?
Step 1: Population characteristic of interest is:
= true mean weight gain.
Step 2: Hypotheses: Ho: =3.5 vs. Ha: >3.5
Step 3: Significance level: =0.05.
Step 4: Check assumptions: (1) random sample (2) normality?
5.5 3.5
Step 5: Test statistic: t = 1.18 = 1.69 , df=n-1=5
Step 6: This is a upper tailed test. So, RR is: t>t(n-1,).
Step 7: Under =0.05, t(5,0.05)=2.015. t=1.69<2.015. We can not
reject Ho.
So, we conclude that there is no strong evidence to show that the
true mean weight gain is more than 3.5 lbs at significant level
0.05.
Null Hypothesis Ho
Alternative Hypothesis Ha
Rejection Region
x
z=
/ n
when
is known.
(2) using
x
t=
s/ n
when
is unknown.
Y X i bn, p
i1
1 X i X,
p Y
n
n
i1
and
EX p
p1 p
;
VarX
n
Thus,
apprpx.
p1 p
n
N p,
p Y
n
apprpx.
N p,
p1 p
n
p
# of trials
and
approx
pp
p1p
n
N p,
p1 p
.
n
approx
N0, 1.
pp 0
p1p
n
p observed proportion.
We could have used z
pp 0
p1 p
n
pp
use p 1p0 when H 0 is true.
0
for this
If H a : p p 0 , then we reject Ho if z z;
If H a : p p 0 , then we reject Ho if
z z;
If H a : p p 0 , then we reject Ho if
|z| z/2.
21
n1
X2 N 2,
X1 X2 N 1 2,
21
n1
22
n2
22
n2
H0 : 1 2
Test statistic: z
X 1 X 2
2
1
n1
2
2
n2
If H a : 1 2 , then we reject Ho if
z z;
If H a : 1 2 , then we reject Ho if
z z;
If H a : 1 2 , then we reject Ho if
|z| z/2.
X 1 X 2 1 2
where
S pooled
S 2pooled
1
n1
1
n2
tn 1 n 2 2,
n 1 1s 21 n 2 1s 22
n 1 n 2 2
X 1 X 2
Test statistic: t
S pooled
1
n1
n12
If H a : 1 2 , then we reject Ho if
t t n 1 n 2 2;
If H a : 1 2 , then we reject Ho if
t t n 1 n 2 2;
If H a : 1 2 , then we reject Ho if
|t| t /2 n 1 n 2 2.
Treatment n 1 21 x 1 63 s 1 18. 5
Control
n 2 21 x 2 43 s 2 18. 1
Solution:
Step 1:
Let 1 be the mean percentage of sleep
time for the rabbits in the treatment groups
were administered a compound containing
Factor S. Let 2 be the mean percentage
of sleep time for the rabbits in the control
group were assigned the same compound
without Factor S.
Step 2:
H 0 : 1 2 versus H a : 1 2
(increases)
Step 3: The significance level is 0. 05,
as required.
Step 4: We assume that the rabbits are
randomly assigned to each group, and the
percentages of sleep times for both groups
are normally distributed.
Step 5:
x 1 x 2 63 43 20
S 2pooled
n 1 1 s 21 n 2 1 s 22
n1 n2 2
2 20 18. 1 2
20
18.
5
40
334. 93
X 1 X 2
S pooled
1
n1
n12
1
21
1
21
20
334.93
3. 54.
n 1 1 s 21 n 2 1 s 22
n1 n2 2
2 32 36. 6 2
21
33.
9
53
1264. 1383
SE
S pooled
1264. 1383
1
22
1
n1
1
33
1
n2
9. 79
0. 306
t 2 51 z 0.025 1. 96
Since 0. 306 1. 96, there is not enough
evidence showing a difference between
the group of Women in 20s and that of
Women in 30s at 0. 05.
Why
n 1 n 2 2S 2pooled
Why t
2 n 1 n 2 2?
2
X 1 X 2 1 2
S pooled
1
n1
1
n2
tn 1 n 2 2?
X 1 X 2
S2
1
n1
S2
2
n2
approx
N0, 1;
X 1 X 2
S2
1
n1
S2
2
n2
approx
t 1 , with
1 minn 1 1, n 2 1
Note: This is a very conservative estimate
of the degrees of freedom;
approx
X 1 X 2
S2
1
n1
S2
2
n2
S2
1
n1
S2
1 /n 1
n 1 1
S2
2
n2
t 2 , with
S2
2 /n 2
n 2 1
p Y
n
apprpx.
pp
p1p
n
p1 p
N p,
n
approx
N0, 1.
pp 0
p 0 1p 0
n
pp 0
p1 p
n
for this
If H a : p p 0 , then we reject Ho if z z;
If H a : p p 0 , then we reject Ho if
z z;
If H a : p p 0 , then we reject Ho if
|z| z/2.
p1 p2
p 1 1p 1
n1
p 2 1p 2
n2
When H 0 : p 1 p 2 is true,
approx
N0, 1
p1 p2
p c 1 p c n11
n p n p
1
n2
, 1
p 1 p 2 p d0
p 1 1p 1
n1
p 2 1p 2
n2
. 2
0.
24
q 1 0. 76
n 1 50 p 1 12
1
50
12
n 2 60 p 2 60 p 2 0. 20 q 2 0. 80
z 2 z 0.01 2. 33
A 98% CI for p 1 p 2 is:
0. 24 0. 20 2. 33 0. 24 0. 76 0. 20 0. 80
60
50
0. 04 0. 1851 0. 1451, 0. 2251
H 0 : p 1 p 2 v.s. H a : p 1 p 2
0.04
Using (1), z 0.07912
0. 506.
Fail to reject H 0 : p 1 p 2 .
Using this example to exercise testing
procedure for comparing two population
proportions.
p 2 1p 2
n2
In this case, z
0.04
0.07944
0. 504 2. 33.
pp 0
p1 p
n
p 2 1p 2
n2
H 0 : 2 20
If H a : 2 20 , then we reject Ho if
n1s 2
2 n 1;
If H a : 2 20 , then we reject Ho if
n1s 2
2
1 n 1;
2
0
If H a : 2 20 , then we reject Ho if
n1s 2
n1s 2
2
2
n 1 or
n 1.
1
2
2
Assumptions:
1 The sample is randomly selected
2 population is normally distributed
1
2
1
2
n1s 2
2
2 n 1.
statistic:
Q
n1s 2
100
32. 52.
n1s 2
36.78
n1s 2
10.98
22147.82
,
36.78
22147.8
10.98
H 0 : 21 22
If H a : 21 22 , then we reject Ho if
s 21
F n 1 1, n 2 1;
s2
2
If H a : 21 22 , then we reject Ho if
s 21
1
1,
n
1
;
F
2
1
s2
2
If H a : 21 22 , then we reject Ho if
s 21
n 1 1, n 2 1 or
F
2
2
s
2
s 21
s 22
F n 2 1, n 1 1
Assumptions:
1 Two samples are random and independent;
2 Both populations are normal.
21
i. e.
21
1 .
22
22
i. e.
21
22
1 v.s. H a : 21 22
Group
s2
n 1 30 x 1 5. 917 s 21 0. 4399
Male
Female n 2 30 x 2 8. 153
s 22 1. 41
s 21
s 22
0.4399
1.41
3. 2053 1 2. 41 1 ,
n 1 1 s 21 n 2 1 s 22
n1 n2 2
2
2
32
36.
6
21
33.
9
53
1264. 1383
SE
S pooled
1264. 1383
1
22
1
n1
1
33
1
n2
9. 79
0. 306
t 2 51 z 0.025 1. 96
Since 0. 306 1. 96, there is not enough
evidence showing a difference between
the group of Women in 20s and that of
Women in 30s at 0. 05.
33.9 2
36.6 2
0. 8579 2. 20 and
0. 4329.
21
22
, F 2 n 1 1, n 2 1;
, F 2 n 1 1, n 2 1.