1 Lecture 1.1
Four steps for hypothesis testing:
1. Formulate the hypotheses.
2. Calculate the test statistic.
3. Make a decision rule of when to reject the hypothesis.
− Fix significance level α
− Use rejection region or P-value.
4. Draw your conclusion.
1.1 One-sample z test
If we have observations from a normal distribution with unknown mean µ and known standard deviation σ, what can we say about µ? Does
µ = µ0 ? Look at the sample mean.
From a population with N (µ, σ) distribution, draw a random sample of n observations.
The sample mean X follows the N µ, √σn distribution.
X−µ
Then z = √
σ/ n
follows the standard normal N (0, 1) distribution.
Standardisation: Subtracting the mean and dividing by the standard deviation.
Central Limit Theorem: If the data are not normally distributed.
From any population (not necessarily normal) with mean µ and standard deviation σ. A random
sample of n observations,
√ where n is sufficiently large. The distribution of the sample mean X is
approximately N µ, σ/ n .
If we observe the sample mean of a random sample, which comes from a population with unknown mean µ and known standard deviation
σ, what can we say about µ? Does µ = µ0 ? If the distribution of the random sample is not normal, this test is only an approximation for large n.
Manufacturers want to know whether the average active ingredient in a type of pills is 50 mg. They take n = 100 samples from the pill
production and measures the sampled average active ingredient to be 50.22 mg.
Assume the active ingredient in each pill is normally distributed with unknown mean µ and known standard deviation σ = 1.
Suppose µ = 50.
1. H0 : µ = 50
Ha : µ 6= 50
√ √ √
2. Sample mean: X ∼ N µ, σ/ n with σ/ n = 1/ 100 = 0.1
X−µ
Standardized sample mean: Z = √
σ/ n
∼ N (0, 1)
What is the probability that
49.8 ≤ X ≤ 50.2?
P 49.8 ≤ X ≤ 50.2 = P 49.8−µ X−µ
√ ≤ 50.2−µ 49.8−50 50.2−50
√
σ/ n
≤ σ/ n
√
σ/ n
=P 0.1
≤Z≤ 0.1
= P (−2 ≤ Z ≤ 2) = 0.9544
What is the probability
that X > 50.2?
√ > 50.2−µ
X−µ 50.2−50
P X > 50.2 = P σ/ n
√
σ/ n
=P Z> 0.1
= P (Z > 2) = 0.0228
What is the probability
that X < 49.8?
X−µ
√ < 49.8−µ 49.8−50
P X < 49.8 = P σ/ n
√
σ/ n
=P Z< 0.1
= P (Z < −2) = 0.0228
X−µ
Possible decision rule: reject µ = 50 if X is below 49.8 or above 50.2, in other words, if Z = √
σ/ n
is below -2 or above 2.
Significance level: When H0 is true, Z ∼ N (0, 1), there is still a small probability that Z < −2 or Z > 2, hence H0 will
be rejected.
Critical values: −z ∗ = −1.96 and z ∗ = 1.96 at significance level α = 0.05.
1
,1.2 z test based on rejection region
Manufacturers want to know whether the average active ingredient in a type of pills is 50 mg. They take n = 100 samples from the pill
production and measures the sampled average active ingredient to be 50.22 mg.
Assume the active ingredient in each pill is normally distributed with unknown mean µ and known standard deviation σ = 1.
2. x = 50.22
σ=1
n = 100
x−µ
Test statistic: z = √
σ/ n
= 50.22−50
√ = 2.2
1/ 100
Critical value: zα/2
∗ ∗
= z0.025 = 1.96
3. Rejection region: if |z|> zα/2
∗ ∗
= z0.025
4. H0 is rejected at the 5% significance level. Conclusion: the amount of the active ingredient is likely to differ from 50 mg.
1.3 P-value
1.4 z test based on rejection region
Manufacturers want to know whether the average active ingredient in a type of pills is 50 mg. They take n = 100 samples from the pill
production and measures the sampled average active ingredient to be 50.22 mg.
Assume the active ingredient in each pill is normally distributed with unknown mean µ and known standard deviation σ = 1.
Suppose µ = 50.
1. H0 : µ = 50
Ha : µ 6= 50
2. x = 50.22
σ=1
n = 100
x−µ
Test statistic: z = √
σ/ n
= 50.22−50
√ = 2.2
1/ 100
Idea: If H0 is true, z should not be an unlikely value.
The p-value is 2P (Z ≥ |z|) = 2P (Z ≥ 2.2) = 0.0278 < α = 0.05
3. If P-value < significance level α, then H0 is rejected.
4. Hence H0 is rejected at the 5% significance level. Conclusion: the amount of the active ingredient is likely to differ from 50 mg.
P-value: If H0 is true, the probability that the test statistic would be as extreme or more extreme than the
observed value. Extreme means deviating from H0 in the direction of Ha .
The smaller the P-value, the stronger the evidence against H0 .
Truth about population
H0 is true H0 is not true
Reject H0 Type I error Correct decision
based on
Decision
sample
Do not reject H0 Correct decision Type II error
Probability for a Type I error = significance level α.
Fix α: the fewer Type II errors, the better the test (higher power).
1.5 95% Confidence interval
The sample mean X can be used to construct a confidence interval for the unknown mean µ.
X−µ
√ ≤ 1.96 = P X − 1.96 √σ ≤ µ ≤ X + 1.96 √σ
0.95 = P (−1.96 ≤ Z ≤ 1.96) = P −1.96 ≤ σ/ n n n
95% confidence interval for µ: X ± 1.96 √σn .
2
,1.6 (1 − α) % Confidence interval
100 × (1 − α) % confidence interval for the mean µ: x ± zα/2
∗ √σ
n
1.7 One-sided vs two-sided z test
Manufacturers want to know whether the average active ingredient in a type of pills deviates from 50 mg.
1. H0 : µ = 50
Ha : µ 6= 50
Manufacturers want to know whether the average active ingredient in a type of pills might be bigger than 50 mg.
1. H0 : µ = 50
Ha : µ > 50
Significance level: α = 0.05
2. x = 50.22
σ=1
n = 100
x−µ
Test statistic: z = √0
σ/ n
= 50.22−50
√ = 2.2
1/ 100
Critical value: zα
∗ =z
0.05 = 1.645
Reject H0 only when z is large.
3. Rejection region: if z > zα
∗ = z∗
0.05
H 0 : µ = µ0 significance level α σ known σ unknown
x−µ x−µ
Test statistic z= √0
σ/ n
t= √0
s/ n
Rejection region ∗
z > zα t > t∗α (n − 1)
Ha : µ > µ 0
P value P (Z ≥ z) P (T ≥ t)
Rejection region ∗
z < −zα t < −t∗α (n − 1)
Ha : µ < µ 0
P value P (Z ≤ z) P (T ≥ T )
Rejection region ∗
|z|> zα/2 |t|> t∗α/2 (n − 1)
Ha : µ 6= µ0
P value 2P (Z ≥ |z|) 2P (T ≥ |t|)
Confidence interval ∗
x ± zα/2 √σ
n
x ± t∗α/2 (n − 1) √s
n
1.8 One-sample t test
The one-sample t test answers the question: If we have observations from a normal distribution with unknown mean µ and unknown standard
deviation σ, what can we say about µ? Does µ = µ0 ?
We can estimate σ with the sample standard deviation s.
From a population with the N (µ, σ) distribution, draw a random sample of n observations.
X−µ
Then T = √
s/ n
follows the t (n − 1) distribution.
As n grows large, the t (n − 1) distribution resembles the N (0, 1) distribution closely.
Manufacturers want to know whether the average active ingredient in a type of pills deviates from 50 mg.
1. H0 : µ = 50
Ha : µ 6= 50
Significance level: α = 0.05
2. x = 50.22
s = 1.08
n = 100
x−µ
Test statistic: t = √0
s/ n
= 50.22−50
√ = 2.037
1.08/ 100
3. Rejection region: Reject H0 if |t|> t∗0.025 (99)
4. H0 is rejected at the 5% significance level. Conclusion: the amount of the active ingredient is likely to differ from 50 mg.
1.9 One-sample t test and non-normality
Test is based on normal distribution of the data.
Mean and standard deviation are sensitive to outliers, hence also the t statistic.
3
, But one-sample t test can still be used if there are no outliers and
− n sufficiently large (n > 100)
− n moderate (20 ≤ n ≤ 100) and little skewness
− n small (n < 20) and data approximately normally distributed.
1.10 Matched pairs t test
Matched pairs t test answers the question: There are two measurements for each individual in the population. Let µ1 and µ2 be their means.
If we observe these two measurements for a random sample, what can we say about µ1 and µ2 ? Does µ1 = µ2 ?
Prices of textbooks at UCLA bookstore and on Amazon.
µ1 : average price at UCLA bookstore
µ2 : average price on Amazon
1. H0 : µ1 = µ2
Ha : µ1 > µ2
Use differences d = x1 − x2 , where x1 is UCLA price and x2 is Amazon price
H0 : µ1 − µ2 = 0
Ha : µ1 − µ2 > 0 ⇒ One-sample t test
2. d = 13.512
sd = 14.972
n = 61
d−µ
Test statistic: t = √0
sd / n
= 13.512−0
√ = 7.049
14.972/ 61
Critical value: t∗α (n − 1) = ∗
t0.05 (60) = 1.671
3. Rejection region: Reject H0 if t > t∗0.05 (60)
4. H0 is rejected at the 5% significance level, the average prices appear to be higher at the UCLA bookstore.
SPSS Output
Tabel 1: Paired Samples Statistics
N Mean Standard deviation Standard Error Mean
UCLA 61 76.533 62.095 7.950
Amazon 61 63.021 51.076 6.540
Tabel 2: Paired Samples Test
Paired Differences
95% Confidence Interval
of the Difference
Mean Standard Standard Lower Upper t df Sig.
Deviation Error Mean (2-tailed)
UCLA-Amazon 13.512 14.972 1.917 9.677 17.346 7.049 60 0.000
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller studenteconometrics. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.21. You're not tied to anything after your purchase.