Professional Documents
Culture Documents
Tõnu Kollo
Fall 2016
Hypothesis Testing
Fall 2016 3 / 24
Hypothesis Testing (3)
Fall 2016 4 / 24
Types of error
Fall 2016 5 / 24
Test statistic, Critical region, Test of significance
Definition
A test statistic is a numerical function of the data whose value
determines the result of the test. The function itself is generally
denoted T = T (X ), where X is theoretical sample, i.e.
represents the data.
After being evaluated for the sample data x, the result is called
an observed test statistic and is written in lowercase, t = T (x).
Definition
The set of all test statistic values for which H0 will be rejected,
is said to be critical region, denoted by C.
Definition
Test of significance is the control rule, which leads to rejection
of H0 if the test statistic value falls in the critical region C:
+
T (X ) ∈ C −→ reject H0 Fall 2016 6 / 24
Example 1
Example 1. The drying time of a paint under specified test
conditions is known to be rv X ∼ N(75, 92 ). Chemists have
proposed a new additive designed to decrease average drying
time. It is believed that drying times with this additive will remain
normally distributed with standard deviation 9. Let µ denote the
true average drying time when the additive is used. The
appropriate hypotheses are :
H0 : µ ≥ 75,
H1 : µ < 75.
Experimental data is to consist of drying times from n = 25 test
specimens. A reasonable rejection region has the form x < c,
where the cut-off value c is suitably chosen. Consider the
choice c = 70.8, so that the test procedure consists of test
statistic X and rejection region x < 70.8. Based on data n = 25
the following decision is made: (test 1) if x < 70.8, then reject
H0 . Find both Type I and II error of this kind of test.
Fall 2016 7 / 24
Example 1
Example 1 continues. Calculation of α and β now involves a
routine standardization of X followed by reference to the
standard normal probabilities:
α = P(Type I error) = P(H0 is rejected when it is true)
= P(X < 70.8 when X ∼ N(75, 1.82 ))
70.8 − 75
= Φ = Φ(−2.33) = 0.01
1.8
Fall 2016 8 / 24
Example 1
Example 1 continues. Calculation of α and β now involves a
routine standardization of X followed by reference to the
standard normal probabilities:
α = P(Type I error) = P(H0 is rejected when it is true)
= P(X < 70.8 when X ∼ N(75, 1.82 ))
70.8 − 75
= Φ = Φ(−2.33) = 0.01
1.8
Fall 2016 8 / 24
Example 1
Example 1 continues. Calculation of α and β now involves a
routine standardization of X followed by reference to the
standard normal probabilities:
α = P(Type I error) = P(H0 is rejected when it is true)
= P(X < 70.8 when X ∼ N(75, 1.82 ))
70.8 − 75
= Φ = Φ(−2.33) = 0.01
1.8
Fall 2016 9 / 24
The Power function
For the moment we suppose that the null hypothesis consists of
one value, which we call θ0 .
Definition
The power function h(θ) of a test is the probability of rejecting
H0 when the value θ is the correct value of the parameter in the
parameter space:
or just
h(θ) = P(T (X ) ∈ C|θ).
So, if β(θ) = P(fail to reject H0 |θ), then
h(θ) = 1 − β(θ).
A test is good if: h(θ) is large for all θ ∈ H1 and h(θ) is small for
θ ∈ H0 .
Fall 2016 10 / 24
The Power function
h(θ0 ) = α.
Fall 2016 11 / 24
Example 1. Comparison of Power functions
Fall 2016 12 / 24
Relationship of α and β
Proposition
Suppose an experiment and a sample size are fixed and a test
statistic is chosen. Then decreasing the size of the rejection
region to obtain a smaller value of α results in a larger value of
β for any particular parameter value consistent with H1 .
This proposition says that once the test statistic and n are
fixed, there is no rejection region that will simultaneously
make both α and all β’s small. A region must be chosen to
effect a compromise between α and β.
Fall 2016 13 / 24
The Power function
If you still feel confused, check this online course page, where
you can find some examples of power function (with some nice
illustrations ,)
Find the page here: Click on me! ,
Fall 2016 14 / 24
Hypotheses about the mean of Normal distribution
In case H0 is true,
σ2
Xi ∼ N(µ0 , σ 2 ), X ∼ N(µ0 , ).
n
Fall 2016 15 / 24
Hypotheses about the mean of Normal distribution
X − µ0
U= √ ∼ N(0, 1), if σ is known.
σ/ n
X − µ0
V = √ ∼ t(f ), f = n − 1, if σ is unknown.
s/ n
Control rule (test) depends on: hypotheses being tested
and available information about σ.
Fall 2016 16 / 24
Hypotheses about the difference of two Population
mean (independent samples)
Let us have two independent samples x1 , . . . , xn1 and
y1 , . . . , yn2 , with corresponding distributions N(µ1 , σ12 ) and
N(µ2 , σ22 ) and the following hypotheses:
H0 : µ1 = µ2 ⇔ µ1 − µ2 = 0,
H1 : µ1 6= µ2 ⇔ µ1 − µ2 6= 0.
Algorithm for testing hypotheses:
Form an estimate for the difference of parameters,
µ̂1 − µ̂2 = x − y .
Corresponding test statistic
X − Y − E(X − Y )
T (X − Y ) = q ∼ F,
Var (X − Y )
where E(X − Y ) = µ1 − µ2 .
Fall 2016 17 / 24
Hypotheses about the difference of two Population
means (independent samples)
Distribution F depends on available information about
variances σ12 and σs2 .
σ12 σ22
If variances are known, then Var (X − Y ) = n1 + n2 and
X − Y − (µ1 − µ2 )
T (X − Y ) = q 2 ∼ N(0, 1),
σ1 σ22
n1 + n2
X − Y − (µ1 − µ2 )
T (X − Y ) = q ∼ t(n1 + n2 − 2),
s n11 + n12
where sP
n1 Pn2
i=1 (xi − x)2 + i=1 (yi − y )2
s= .
n1 + n2 − 2
Fall 2016 18 / 24
Hypotheses about the difference of two Population
means (independent samples)
• If there is no information
2 about σ1 and σ2 , then
s1 s22
Var (X − Y ) = n1 + n2 and
d
X − Y − (µ1 − µ2 )
T (X − Y ) = q 2 ∼ t(f ) ≈ N(0, 1),
s1 s22
n1 + n2
where
n
1 2 n
1 X 1 X
s12 = (xi − x)2 and s22 = (yi − y )2 ,
n1 − 1 n2 − 1
i=1 i=1
s12 2 2
s1
n1 + n2
f =
(s12 /n1 )2 (s22 /n2 )2
n1 −1 + n2 −1
Fall 2016 19 / 24
Hypotheses about the difference of two Population
means (independent samples)
Fall 2016 20 / 24
Using the Normal Approximation
We have showed beforehand how the normal approximation
can be used for interval estimation. Hypothesis testing can be
performed in a similar way.
Let us have a random sample x1 , . . . , xn from F (θ), where θ
is unknown. F is not a Normal distribution.
Consider hypotheses
H0 : θ = θ0 ,
H1 : θ 6= θ0 .
Consider a consistent point estimate of θ, θ̂.
If H0 is true, then in case n → ∞,
θ̂ − θ0 θ̂ − θ0
U=q −→ N(0, 1), V = q −→ N(0, 1).
Var (θ̂) Var
d (θ̂)
Fall 2016 21 / 24
Using the Normal Approximation
Fall 2016 22 / 24
Application to the Binomial Distributions
Let p denote the proportion of individuals or objects in a population
who possess a specified property (e.g. cars with manual
transmissions or smokers who smoke a filter cigarette).
Let us have a random sample x1 , . . . , xn . We are interested in testing
the following hypotheses:
H0 : p = p0
H1 : p 6= p0
Consider the point estimate pb of parameter p.
The distribution of corresponding estimator p̂ is approximately
Normal when n increases ((np0 ≥ 10), n(1 − p0 ) ≥ 10). So in case of
large sample
p̂ − E p̂ H0 truep̂ − p0 ·
U= p = p ∼ N(0, 1)
Var p̂ p0 (1 − p0 )/n
Fall 2016 23 / 24
Application to the Binomial Distributions. Example
Example 1. A food industry plans to replace the standard production
method by a new one. It is then important to know if the flavour of the
product is changed. A so-called triangle test is performed. Each of
500 persons tastes, in random order, three packets of the product,
two of which are manufactured according to the standard method and
one according to the new method. Each person is asked to select the
packet which tastes differently from the two others.
200 persons select the packet with new production. If there is no
difference between the tastes, the probability that the new method is
selected is 1/3; if there is a difference, we will have p > 1/3. Hence
our hypotheses are
H0 : p = 1/3
H1 : p > 1/3.
The firm is satisfied with α = 0.05, λ0.05 = 1.64. Compute
200 1
p̂ − p0 500 − 3
u=p = 1 2 1
= 3.2
p0 (1 − p0 )/n 3 · 3 · 500
Since 3.2 > 1.64, we can reject H0 and say that there is difference
between the tastes. Fall 2016 24 / 24