Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Statistical Inference
2
objectives
• Understand the fundamental concepts of hypothesis
testing
• Set up the null and alternative hypotheses, and be
familiar with the steps involved in hypothesis testing
• Test hypotheses regarding the population mean
when the population variance is known
• Understand the p-value approach to testing
hypotheses and calculate the p-value of a test
• Test hypotheses regarding the population mean
when the population variance is unknown
• Test hypotheses regarding the population proportion P
• Interpret the results of a test of hypothesis
Introduction
Example
• In a criminal trial, a jury must decide whether the
defendant is innocent or guilty based on the
evidence presented at the court.
Concepts of hypothesis testing:
1. There are two hypotheses, the null and the alternative
hypotheses.
2. The procedure begins with the assumption that the
null hypothesis is true.
3. The goal is to determine whether there is enough
evidence to infer that the alternative hypothesis is
true.
In a criminal trial
o o o
Step 1 :Set up the null and alternative hypotheses
Hypothesis to test:
Right-tail test H0: μ=μ0
HA: μ>μ0
Level of significance =
μ=μ0 xc 0 z
Rejection region: x > xc
If the selected sample gives a sample mean value very much larger than μ0,
then we should reject H0 for larger values of 𝑋.ത That is, the rejection region
in this case will be on the right tail of the sampling distribution of the test
statistic. Since P(reject H0 when H0 is true) = , the area of the whole right
tail will be equal to .
Step 1 :Set up the null and alternative hypotheses
Hypothesis to test:
Left-tail test H0: μ=μ0
HA: μ<μ0
Level of significance =
xc μ=μ0
x -z 0
Rejection region: x < xc
If the selected sample gives a sample mean value very much smaller than μ0,
then we should reject H0 for smaller values of 𝑋.ത That is, the rejection region
in this case will be on the left tail of the sampling distribution of the test
statistic. Since P(reject H0 when H0 is true) = , the area of the whole left tail
will be equal to .
Step 1 :Set up the null and alternative hypotheses
Hypothesis to test:
Two-tail test H0: μ=μ0
HA: μμ0
Level of significance =
If the selected sample gives a sample mean value either very much larger or
very much smaller than μ0, then we should reject H0 for either larger or
ത That is, the rejection region in this case will be both tails
smaller values of 𝑋.
of the sampling distribution of the test statistic. Since P(reject H0 when H0 is
true) = and the distribution is symmetric, the area of each tail will be equal
to /2.
Step 2: Test Statistic
Test statistics
We need to use a sample statistic to test a hypothesis.
Test on population mean, μ: Ho: = o
a) If population variance σ2 is known
X 0
ത standardised test statistic:
Test statistic: 𝑋; Z ~N(0,1)
/ n
Example 1
Using a 5% significance level, can the inspector
conclude that the product label is unacceptable?
(Assume that the inspector knows from previous
experiments that the weight of all 500g garlic packs
distributed by Ausvege Ltd is normally distributed
with a standard deviation of 10g and n=25
A real world Application: How to test a claim
H0: = 500
Then Left one-tail test
HA: < 500
1. Our hypotheses
3. Level of significance: = 0.05
H0: = 500
HA: < 500 4. Decision rule
Left one-tail test
Reject Ho if Zcalc < – zcrit = -1.645
2. The test statistic is: (or Reject Ho if p-value < = 0.05)
X
Z ~ N (0,1)
n
z-value method:
X 499.76 500
Z 0.12
0.05 n 10 25
Do not
reject H0
x 499.76 500 x
A sample mean far below 500
Do not
should be a rare event if = 500. 0.05 reject H0
p-value calculation
In general:
For a right tail test (HA: μ > μ0), p-value = P(z > z0)
For a left tail test (HA: μ < μ0), p-value = P(z < -z0)
For a two-sided test (HA: μ ≠ μ0), p-value = 2P(z >|z0|)
Decision rule
If p-value < , we reject H0.
If p-value > , we do not reject H0.
A real world Application: How to test a claim
p-value Method
0.05
–0.12
Rejection region –z = –1.645 0
INTERPRET
Since the value of the test statistic
does not fall in the rejection region,
Zcalc = -0.12 > -1.645 = zcrit
we do not reject the null hypothesis
in favour of the alternative hypothesis. There is insufficient
OR (alternatively) evidence to infer
that the mean is less
Since the p-value is greater than the than 500 grams.
level of significance,
P(Z < – 0.12) = 0.4522 > 0.05
we do not reject the null hypothesis in
favour of the alternative hypothesis.
Example 2: Time required to complete an
assembly line
The mean of the amount of time required to complete a
critical part of a production process on an assembly line
is believed to be 130 seconds. To test if this belief is
correct, a sample of 100 randomly selected assemblies
is drawn and the processing time recorded. The sample
mean is 126.8 seconds. If the process time is normally
distributed with a standard deviation of 15 seconds, can
we conclude that the belief regarding the mean is
incorrect?
Example 2: Solution IDENTIFY
=0.025 =0.025
-z.025 +z.025 z
0
= -1.96 = 1.96
6. Conclusion
In Example 2, we obtained
Zcalc = -2.13
Since it was a two-tail test,
p-value = P(Z < -2.13) + P(Z >2.13)
= 2(0.0166) = 0.0332
The p-value of a test of hypothesis…
½ p-value ½ p-value
=0.0166 =0.0166
-2.13 2.13 z
0
The p-value of a test of hypothesis…
X
t
s n
This statistic is Student t-distributed with (n–1) degrees
of freedom.
Example 3 – Has production declined due to
new government regulations?
96.47 100
t 2.82
4.85 / 15
6. Conclusion:
t-value method
As tcalc = -2.82 < tcrit= -1.1761, reject H0.
There is enough evidence to conclude that mean daily
production has decreased after the installation of the
safety device.
CALCULATE
Example 3: Solution…
6. Conclusion (cont.):
p-value method
tcalc = -2.82
Need Excel to obtain p–value corresponding to t-statistic
From Excel: p-value (one tail) =TDIST(2.82,14,1)= 0.0068
Since p-value = 0.0068 < = 0.05, we reject H0.
p-value = 0.0068
INTERPRET
Example 3: Solution…
Interpreting the results
There is enough evidence to conclude that mean daily
production has decreased after the installation of the
safety device.
Note that the results are valid only if the assumption that
daily output is normally distributed is true.
Testing the population proportion
When the population consists of nominal or categorical
data, the only test we can perform is about the
proportion of occurrence of a certain value.
Testing the population proportion…
x
p̂ where
n
x the number of successes .
n sample size .
Under certain conditions, [np 5 and nq 5],
𝑝Ƹ is approximately normally distributed, with
μ = p and σ2 = pq/n.
Testing the population proportion…
Ho: p = po
Test statistic for p
pˆ p0
Z ~ N (0,1)
p0 q0 / n
where np 5 and nq 5.
Example 4: Is the market share large
enough to introduce a new product?
2. Test statistic: 𝑝Ƹ
Standardised test statistic:
pˆ p
Z ~ N (0,1)
pq n
6. Conclusion:
z-value method:
Since z calc = 2.00 > z crit =1.645, we reject H0.
Example 5: Solution…
6. Conclusion (cont.):
p-value method:
p-value = P(z > 2.00) = 0.0228
Since p-value = 0.0228 < 0.05, we reject Ho.