Hypothesis Testing
Hypothesis Testing
Hypothesis Testing
C O U R S E : B U S I N E S S S TAT I S T I C S ( Q M M 5 0 1 )
Fall 2021
3
Introduction to Hypothesis Testing
Statistical Inference
Hypothesis testing is the second form of statistical inference.
◦ population mean
Example: The mean monthly cell phone bill
of this city is µ = $42
◦ population proportion
Example: The proportion of adults in this
city with cell phones is P = .68
Introduction to Hypothesis Testing
The Null Hypothesis, H0
The null hypothesis, H0, refers to the status quo (the current
state of things)
Example: The average number of TV sets in U.S. Homes is 3 or more
( ) H0 : μ 3
Is always about a population parameter, not about a
sample statistic
H0 : μ 3 H0 : x 3
Introduction to Hypothesis Testing
The Null Hypothesis, H0
The analyst will believe the claim unless sufficient evidence is found to
discredit it.
Introduction to Hypothesis Testing
Hypothesis Testing Process
Claim: the population mean age is 50.
Null Hypothesis: H0: µ = 50
Population
Now select a random sample:
Sample
Suppose the sample Is x = 20 If not likely,
mean age is 20: likely if REJECT
x = 20 µ = 50? Null Hypothesis
Introduction to Hypothesis Testing
Reason for Rejecting H0
Sampling Distribution of x
x
20 μ = 50
If H0 is true
If it is unlikely that ... then we
we would get a reject the null
sample mean of ... if in fact this were hypothesis that
this value ... the population mean… μ = 50.
Introduction to Hypothesis Testing
Rejection and Non-Rejection Regions
If the sample mean is close to the stated population mean, the null
hypothesis is not rejected.
If the sample mean is far from the stated population mean, the null
hypothesis is rejected.
How far is “far enough” to reject H0?
The critical value of a test statistic creates a “line in the sand” for
decision making -- it answers the question of how far is far enough.
Region of Region of
rejection rejection
Region of
non-rejection
Critical
values
“Too far away” from
mean of sampling
distribution
State of Nature
Decision H0 True H0 False
Do Not
No error Type II Error
Reject
(1 - a ) (β)
H0
Reject Type I Error No Error
H0 (a) (1-β)
Introduction to Hypothesis Testing
Errors in Making Decision
The confidence coefficient (1-α) is the probability of not rejecting H0 when it is true.
The power of a statistical test (1-β) is the probability of rejecting H0 when it is false.
19
BUSINESS STATISTICS II (WINTER SESSION 2015-16)
Introduction to Hypothesis Testing
Errors in Making Decision
Type I Error
◦ Reject a true null hypothesis
◦ Considered a serious type of error
The probability of Type I Error is
Type II Error
◦ Fail to reject a false null hypothesis
The probability of Type II Error is β
Introduction to Hypothesis Testing Type
I & II Error Relationship
Type I and Type II errors cannot happen at
the same time
Type I error can only occur if H0 is true
Type II error can only occur if H0 is false
The p-value approach (which is generally used with a computer and statistical
software).
= .05
-zα= -1.645 0
= .05
z
Reject H0 Do not reject H0
-1.645 0
-2.0
Now
expressed
= .05 in x, not z
units
x
Reject H0 Do not reject H0
2.8684 3
2.84 σ 0.8
x α μ zα 3 1.645 2.8684
n 100
σ
x μ z
n
Critical Values for
Two Tailed Tests
or /2 /2
xα/2
Lower
Reject H0 Do not reject H0 Reject H0
xα/2 -zα/2 0 zα/2
Upper
xα/2 µ=3 xα/2
Lower Upper
σ
x /2 μ z /2
n
The Rejection Region
Level of Significance a
Lower tail test Upper tail test Two tailed test
Example: Example: Example:
H 0: μ ≥ 3 H 0: μ ≤ 3 H 0: μ = 3
HA: μ < 3 HA: μ > 3 HA: μ ≠ 3
a a a /2 a/2
Reject H0 if z < -zα Reject H0 if z > zα Reject H0 if z < -zα/2 or z > zα/2
i.e., if x < xα i.e., if x > xα i.e., if x < xα/2(L) or x > xα/2(U)
p-Value Approach to Testing
p-value: probability of obtaining a test statistic more extreme
( ≤ or ) than the observed sample value given H0 is true
◦ Also called observed level of significance
◦ Smallest value of for which H0 can be rejected
Compare the p-value with
◦ If p-value < , reject H0
◦ If p-value , do not reject H0
p-value example
Example: How likely is it to see a sample mean of 2.84 (or something further below the mean) if
the true mean is = 3.0?
= .05
P( x 2.84 | μ 3.0)
p-value =.0228
2.84 3.0
P z
0.8
100 3
2.8684 x
P(z 2.0) .0228 2.84
-1.645 0 z
-2.0
p-value example (continued)
= .05
Here: p-value = .0228
= .05 p-value =.0228
Since .0228 < .05, we reject
the null hypothesis
3
2.84
Example: Upper Tail z Test
for Mean ( Known)
A phone industry manager thinks that customer monthly
cell phone bill have increased, and now average over $52
per month. The company wishes to test this claim.
Assume = 10 is known.
= .10
xμ 53.1 52
z 0.88
σ 10
n 64
Example: Decision
Reach a decision and interpret the result:
(continued)
Reject H0
= .10
p-value = .1894
P(x 53.1|μ 52.0)
Reject H0
= .10
53.1 52.0
P z
10
0 64
Do not reject H0 Reject H0
1.28 P(z 0.88) 1 .8106
z = .88
.1894
where z is the actual value of the test statistic and |z| is its absolute value.
Hypothesis Tests about a Population
Mean: Known
Lower tail test Upper tail test Two-tailed test
Hypotheses
Test Statistic
P-Value
43
Hypothesis tests for the mean µ (σ is
known): Assumptions
The z formula can be used to test hypothesis about
a single population mean if
the sample size n is > 30 for any population, and
X is normally distributed if n < 30
44
Hypothesis tests for the mean
Hypothesis
Tests for
Known Unknown
(z-test) (t-test)
45
Inference about μ (σ Unknown)
Assumptions
◦ Population standard deviation is unknown
◦ Population is normally distributed
◦ If population is not normal, use large sample
(n large)
12.46
Inference about μ (σ Unknown)
When s is unknown, we use its point estimator s
12.47
Example 2
In recent years a number of companies have gone into the business of collecting used
newspapers from households and recycling them.
The firm would make a profit if the mean weekly newspaper collection from each
household exceeded 2.0 pounds.
A random sample of 148 households was drawn from a large community, and the
weekly weight of newspapers discarded for recycling for each household was
recorded with the following results: .
x 2.18 and s 0.981
Do these data provide sufficient evidence to conclude that a recycling plant would be
profitable?
12.48
Example 2 IDENTIFY
The parameter to be tested is the population mean µ, the average amount of newspapers
discarded per household.
We want to know if there is enough evidence to conclude that the mean is greater than 2.
Thus,
H1: µ > 2
12.49
Example 2 IDENTIFY
x 2.18
s 0.981
x 2.18 2.0
t 2.23
s 0.981
n 148
Since 2.23 < 2.351, we do not have enough evidence to reject the null hypothesis.
12.51
Example 2 INTERPRET
The value of the test statistic is t = 2.23 and its p-value is .0134.
12.52
Hypothesis Testing for m with s
unknown
Write the rejection region for a left-tail test
12.53
Example 3
The U.S. Farmers’ Production Company builds large harvesters. For a harvester to be properly
balanced when operating, a 25-pound plate is installed on its side. The machine that produces
these plates is set to yield plates that average 25 pounds. The distribution of plates produced from
the machine is normal. However, the shop supervisor is worried that the machine is out of
adjustment and is producing plates that do not average 25 pounds
54
Example 3
To test this concern, he randomly selects 20 of the plates produced the day before and weighs
them.
The sample mean and sample standard deviation are equal to 25.51 and 2.1933
55
Example 3
H0: μ = 25
a/2 = 0.025 a/2 = 0.025
H1: μ ¹ 25
0
• a = 0.05 Reject H0 Do not reject H0 Reject H0
t 24,0.025
-t 24,0.025
• n = 20, df = 20-1=19 -2.093 1.04 2.093
• is unknown, so t STAT
X μ
25.51 25
1.04
S 2.1933
use a t statistic n 20
• Critical Value:
Do not reject H0: insufficient evidence that true
±t19,0.025 = ± 2.093 mean weight is different from 25 pounds
56
Example 3
Connection of two-tail tests to confidence intervals
For X-bar = 25.51, s = 2.193 and n = 20, the 95% confidence interval
for µ is 24.484 ≤ μ ≤ 26.536
Since this interval contains the hypothesized mean (25), we do not reject
the null hypothesis at = 0.05
57
Example 4
The U.S. Department of Agriculture show that the average size of farms has
increased since 1940. In 1940, the mean size of a farm was 174 acres; by 1997,
the average size was 471 acres. Between those years, the number of farms
decreased but the amount of tillable land remained relatively constant, so now
farms are bigger. This trend might be explained, in part, by the inability of small
farms to compete with the prices and costs of large-scale operations and to
produce a level of income necessary to support the farmers’ desired standard of
living.
58
Example 4
Suppose an agribusiness researcher believes the average size of farms
has now increased from the 1997 mean figure of 471 acres. To test
this notion, she randomly sampled 23 farms across the United States
and ascertained the size of each farm from county records. The data
she gathered follow. Use a 5% level of significance to test her
hypothesis. Assume that number of acres per farm is normally
distributed in the population.
445 489 474 505 553 477 454 463 466 557 502 449 438 500 466 477
557 433 545 511 590 561 560
59
Example 4
H0: μ ≤ 471; H1: μ > 471
Suppose that = 0.05 is chosen for this test
and n = 23. Find the rejection region.
Reject H0
=0.05
0
Do not reject H0 Reject H0
T0.05,22 = 1.717
61
Example 4
Reject H0
= 0.05
0
Do not reject H0 Reject H0
1.717
t = 2.84
62
Example: Utilizing The p-value for The
Test
Calculate the p-value and compare to
(the p-value below is calculated
using a software)
Reject H0 since p-value = .0048 <
= .05
63
SPSS demonstration
Select Analyze / Compare Means / One-Sample T Test…
64
SPSS demonstration
Choose the test value
Click on Options and choose the sigificance level
65
SPSS demonstration
SPSS conducts the two-tailed test.
To get the p-value of the one-tailed test, you should divide the printed p-value by 2
66
Hypothesis tests about a population
Mean ( unkown)
Lower tail test Upper tail test Two-tailed test
Hypotheses
Test Statistic
P-Value
67
Inference about Population Proportion
When data are nominal, we count the number of occurrences of each value and
calculate proportions.
Thus, the parameter of interest in describing a population of nominal data is the
population proportion p.
where p-hat () is the sample proportion and x the number of successes in a sample
size of n items.
12.68
Inference: Population Proportion…
12.69
Example: Z Test for Proportion
A marketing company claims
that it receives 8% responses
from its mailing. You believe
that the response rate is
different. A random sample of
500 mails were surveyed. 25
received responses. Check:
Test at the = .05 n p = (500)(.08) = 40
significance level whether the n(1- p) = (500)(.92) = 460
claim is wrong.
12.70
Z Test for Proportion: Solution
Test Statistic:
H0: p = .08
p̂ p .05 .08
HA: p ¹ .08 z 2.47
p(1 p) .08(1 .08)
a = .05
n = 500, p̂= .05 n 500
Hypotheses
pˆ p 0 pˆ p 0 pˆ p 0
Test Statistic z z z
p 0 (1 p 0 ) p 0 (1 p 0 ) p 0 (1 p 0 )
n n n
P-Value
Rejection Rule: P- Reject H0 if Reject H0 if Reject H0 if
value Approach p-value≤α p-value≤α p-value≤α
Rejection Rule:
Critical Value
Approach
72
Tests of the Variance of a Normal
Distribution
Goal: Test hypotheses about the population
variance, σ2 (e.g., H0: σ2 = σ02)
(n 1)s2
χn21 2
σ0
a a a/2 a/2
76
77