Download Hypothesis Testing

Document related concepts
Transcript
Chapter 9
Hypothesis Testing
Understandable Statistics
Ninth Edition
By Brase and Brase
Prepared by Yixun Shi
Bloomsburg University of Pennsylvania
Methods for Drawing Inference
• We can draw inference on a population
parameter in two ways:
1) Estimation (Chapter 8)
2) Hypothesis Testing (Chapter 9)
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|2
Hypothesis Testing
• In essence, hypothesis testing is the process of
making decisions about the value of a
population parameter.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|3
Establishing the Hypotheses
• Null Hypothesis: A hypothesis about the
parameter in question that often denotes a
theoretical value, an historical value, or a
production specification.
– Denoted as H0
• Alternate Hypothesis: A hypothesis that differs
from the null hypothesis, such that if we reject
the null hypothesis, we will accept the alternate
hypothesis.
– Denoted as H1 (in other sources HA).
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|4
Hypotheses Restated
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|5
Types of Tests
• The null hypothesis is always a statement of
equality.
– H0: μ = k, where k is a specified value
• The alternate hypothesis states that the
parameter (μ, p) is less than, greater than, or
not equal to a specified value.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|6
Types of Tests
• Left-Tailed Tests:
H1: μ < k
H1: p < k
• Right-Tailed Tests:
H1: μ > k
H1: p > k
• Two-Tailed Tests:
H1: μ ≠ k
H1: p ≠ k
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|7
Hypothesis Testing Procedure
1)
2)
3)
4)
Select appropriate hypotheses.
Draw a random sample.
Calculate the test statistic.
Assess the compatibility of the test statistic
with H0.
5) Make a conclusion in the context of the
problem.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|8
Hypothesis Test of μ
x is Normal, σ is Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9|9
P-Value
P-values are sometimes called the probability of chance.
Low P-values are a good indication that your test results are not
due to chance.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 10
P-Value for Left-Tailed Test
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 11
P-Value for Right-Tailed Test
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 12
P-Value for Two-Tailed Test
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 13
Types of Errors in Statistical Testing
• Since we are making decisions with incomplete
information (sample data), we can make the
wrong conclusion!!
– Type I Error: Rejecting the null hypothesis
when the null hypothesis is true.
– Type II Error: Accepting the null hypothesis
when the null hypothesis is false.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 14
Errors in Statistical Testing
• Unfortunately, we usually will not know when
we have made an error!!
• We can only talk about the probability of making
an error.
• Decreasing the probability of making a type I
error will increase the probability of making a
type II error (and vice versa).
• We can only decrease the probability of both
types of errors by increasing the sample size
(obtain more information), but this may not be
feasible in practice.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 15
Type I and Type II Errors
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 16
Level of Significance
• Good practice is to specify in advance the level
of type I error we are willing to risk.
• The probability of type I error is the level of
significance for the test, denoted by α (alpha).
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 17
Type II Error
• The probability of making a type II error is
denoted by β (Beta).
• 1 – β is called the power of the test.
– 1 – β is the probability of rejecting H0 when
H0 is false (a correct decision).
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 18
The Probabilities
Associated with Testing
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 19
Concluding a Statistical Test
For our purposes, significant is defined as follows:
At our predetermined α level of risk, the evidence against H0
is sufficient to discredit H0. Thus we adopt H1.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 20
Statistical Testing Comments
• In most statistical applications, α = 0.05 or
α = 0.01 is used
• When we “accept” the null hypothesis, we are
not proving the null hypothesis to be true. We
are only saying that the sample evidence is not
strong enough to justify the rejection of the null
– Some statisticians prefer to say “fail to reject
the null” rather than “accept the null.”
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 21
Interpretation of Testing Terms
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 22
Testing µ When σ is Known
1) State the null hypothesis, alternate hypothesis,
and level of significance.
2) If x is normally distributed, any sample size will
suffice. If not, n ≥ 30 is required.
Calculate:
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 23
Testing µ When σ is Known
3) Use the standard normal table and the type of
test (one or two-tailed) to determine the Pvalue.
4) Make a statistical conclusion:
If P-value ≤ α, reject H0.
If P-value > α, do not reject H0.
5) Make a context-specific conclusion.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 24
Testing µ When σ is Unknown
1) State the null hypothesis, alternate hypothesis,
and level of significance.
2) If x is normally distributed (or mound-shaped),
any sample size will suffice. If not, n ≥ 30 is
required. Calculate:
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 25
Testing µ When σ is Unknown
3) Use the Student’s t table and the type of test
(one or two-tailed) to determine (or estimate)
the P-value.
4) Make a statistical conclusion:
If P-value ≤ α, reject H0.
If P-value > α, do not reject H0.
5) Make a context-specific conclusion.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 26
Using Table 6 to Estimate P-Values
Suppose we calculate t = 2.22 for a one-tailed test from a sample
size of 6.
Thus, df = n – 1 = 5.
We obtain: 0.025 < P-Value < 0.050
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 27
Testing µ Using the
Critical Value Method
• The values of x that will result in the rejection
of the null hypothesis are called the critical
region of the x distribution
• When we use a predetermined significance
level α, the Critical Value Method and the PValue Method are logically equivalent.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 28
Critical Regions for H0: µ = k
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 29
Critical Regions for H0: µ = k
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 30
Critical Regions for H0: µ = k
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 31
Testing µ When σ is Known
(Critical Region Method)
1) State the null hypothesis, alternate hypothesis,
and level of significance.
2) If x is normally distributed, any sample size will
suffice. If not, n ≥ 30 is required.
Calculate:
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 32
Testing µ When σ is Known
(Critical Region Method)
3) Show the critical region and critical value(s) on
a graph (determined by the alternate hypothesis
and α).
4) Conclude in favor of the alternate hypothesis if
z is in the critical region.
5) State a conclusion within the context of the
problem.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 33
Left-Tailed Tests
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 34
Right-Tailed Tests
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 35
Two-Tailed Tests
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 36
Testing a Proportion p
• Test assumptions:
r is a binomial variable
n is the number of independent trials
p is the probability of success on each trial
np > 5 and n(1-p) > 5
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 37
Types of Proportion Tests
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 38
The Distribution
of the Sample Proportion
r
Recall the distributi on of p̂ 
n
is approximat ely normal with :
  p and  
p(1  p)
n
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 39
Converting the Sample Proportion to z
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 40
Testing p
1) State the null hypothesis, alternate hypothesis,
and level of significance.
2) Check np > 5 and nq > 5
(recall q = 1 – p). Compute:
p = the specified value in H0
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 41
Testing p
3) Use the standard normal table and the type of
test (one or two-tailed) to determine the Pvalue.
4) Make a statistical conclusion:
If P-value ≤ α, reject H0.
If P-value > α, do not reject H0.
5) Make a context-specific conclusion.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 42
Using the Critical Value Method for p
• As when testing for means, we can use the
critical value method when testing for p.
• Use the critical value graphs exactly as when
testing µ.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 43
Critical Thinking: Issues Related to
Hypothesis Testing
• Central question – Is the value of sample test
statistics too far away from the value of the
population parameter proposed in H0 to occur
by chance alone? – P-value tells the probability
for that to occur by chance alone.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 44
Critical Thinking: Issues Related to
Hypothesis Testing
• If the P-value is so close to α, then we might
attempt to clarify the results by
- Increasing the sample size
- controlling the experiment to reduce the
standard deviation.
• How reliable is the study and the
measurements in the sample? – consider the
source of the data and the reliability of the
organization doing the study.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 45
Tests Involving Paired Differences
• Data pairs occur naturally in many settings:
– Before and after measurements on the same
observation after a treatment.
– Be sure to have a definite and uniform
method for creating pairs of data points.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 46
Advantages to Using Paired Data
• Reduces the danger of extraneous or
uncontrollable variables
• Theoretically reduces measurement variability.
• Increases the accuracy of statistical
conclusions.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 47
Testing for Differences
• We take the difference between each pair of
data points.
– Denoted by d
• We then test the average difference against the
Student’s t distribution.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 48
Hypotheses for Differences
H0: µd = 0
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 49
Sample Test Statistic for Differences
with
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 50
Finding the P-Value
• Just as in the test for µ when σ is unknown, use
Table 6 to estimate the P-Value of the test.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 51
Testing d
1) State the null hypothesis, alternate hypothesis,
and level of significance.
2) If you can assume d is normal (mound-shaped),
any sample size will do. If not, make sure n ≥
30. Calculate:
df = n-1
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 52
Testing d
3) Use the Student’s t table and the type of test
(one or two-tailed) to determine (or estimate)
the P-value.
4) Make a statistical conclusion:
If P-value ≤ α, reject H0.
If P-value > α, do not reject H0.
5) Make a context-specific conclusion.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 53
Testing the Differences
Between Independent Samples
• Many practical applications involve testing the
difference between population means or
population proportions.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 54
Testing µ1 - µ2 when σ1, σ2 are Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 55
Hypotheses for Testing
µ1 - µ2 when σ1, σ2 are Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 56
Testing µ1 - µ2 when σ1, σ2 are Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 57
Testing µ1 - µ2 when σ1, σ2 are Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 58
Testing µ1 - µ2 when σ1, σ2 are Known
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 59
Testing µ1 - µ2
when σ1, σ2 are Unknown
• Just as in the one-sample test for the mean, we
will resort to the Student’s t distribution and
proceed in a similar fashion.
– Remark: in practice, the population standard
deviation will be unknown in most cases .
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 60
Testing µ1 - µ2
when σ1, σ2 are Unknown
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 61
Testing µ1 - µ2
when σ1, σ2 are Unknown
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 62
Testing µ1 - µ2
when σ1, σ2 are Unknown
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 63
Deciding Which Test
to Use for H0: µ1 - µ2
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 64
Testing for a Difference
in Proportions, p1 – p2
• Suppose we have two independent binomial
experiments.
• We would like to test if the two population
proportions are equal.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 65
Testing for a Difference in Proportions
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 66
Testing for a Difference in Proportions
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 67
Testing for a Difference in Proportions
• The test statistic is as follows:
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 68
The Test Procedure
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 69
The Test Procedure
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 70
The Test Procedure
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 71
The Test Procedure
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 72
Critical Regions For Tests of Differences
Recall, our emphasis is on the P-Value method. Most scientific
studies use this technique. Also, for a fixed α-level test, the
methods
are equivalent and lead to identical results.
Copyright © Houghton Mifflin Harcourt Publishing Company. All rights reserved.
9 | 73