Notes 12
Notes 12
n = sample size
1
Statistical Inference
Statistical Inference
= inference about the population based on a
sample
• Parameter estimation
• Confidence intervals
• Hypothesis testing
• Model fitting
2
Statistical Inference
Parameter Estimation
3
Parameter estimation
Estimation of a mean
Estimation of a variance
θ = σ 2 = Var(Xi)
by a sample variance
n
1 ∑
S2 = (Xi − X̄)2
n − 1 i=1
5
Parameter estimation
Estimation of a proportion
So, p̂ is unbiased;
√
p(1 − p)
its standard error is SE(p̂) =
n
√
d p̂(1 − p̂)
typically estimated by SE(p̂) =
n
6
Parameter Estimation
1. Method of Moments
Estimate λ.
1
M1 = X̄; µ1 =
λ
Solve
1 1
M1 = µ 1 ⇒ X̄ = ⇒ λ̂mom =
λ X̄
8
2. Method of Maximum Likelihood
Implementation
Maximize
n
∏
f (X1, ..., Xn | θ) = f (Xi | θ)
i=1
in θ.
Simplification: maximize
n
∑
ln f (X1, ..., Xn | θ) = ln f (Xi | θ)
i=1
Typically, compute
n
∑
∂ ∂
ln f (X1, ..., Xn | θ) = ln f (Xi | θ)
∂θ i=1 ∂θ
equate to 0 and solve in θ.
9
Method of maximum likelihood
n
∑ ( )
ln f (X1, ..., Xn | θ) = ln λe−λXi
i=1
n
∑
= n ln λ − λ Xi
i=1
n
∑
∂ n
ln f (X1, ..., Xn | θ) = − Xi =: 0
∂λ λ i=1
Solve for λ,
n 1
λ̂mle = ∑ =
Xi X̄
10
Maximum likelihood
6
- 2h
11
Statistical Inference
Confidence Intervals
That is,
P {a ≤ θ ≤ b} = 1 − α
where
12
Confidence intervals
Confidence intervals
samples of data
-
θ
Confidence intervals and coverage of parameter θ.
13
Confidence intervals
1 ∑
1. Estimate θ = µ by its estimator X̄ = n Xi.
4. Then we have
{ }
X̄ − µ
P −zα/2 < √ < zα/2 =1−α
σ/ n
Solve for µ:
{ }
zα/2σ zα/2σ
P X̄ − √ < µ < X̄ + √ =1−α
n n
5. Hence,
[ ]
zα/2σ zα/2σ zα/2σ
X̄ ± √ = X̄ − √ , X̄ + √
n n n
is a (1 − α)100% confidence interval for µ.
When σ is unknown
Result:
tα/2,n−1S
X̄ ± √
n
16
TESTING HYPOTHESES
Collect data
⇓
Conduct a test
⇓
State if there is sufficient evidence to reject
H0 in favour of HA.
α = P { Type I error }
17
Hypotheses testing
Test H0 : µ = µ0 vs HA : µ ̸= µ0.
18
Hypotheses testing
19
Hypotheses testing
20
Hypotheses testing
v
u n (
u 1 ∑ )2
1. Estimate σ by S = t Xi − X̄
n−1 1
21
Hypotheses testing, Z-tests
Null Parameter,
hypothesis estimator If H0 is true: Test statistic
θ̂ − θ0
H0 θ, θ̂ E(θ̂) Var(θ̂) Z= √
Var(θ̂)
σ2 X̄ − µ0
µ = µ0 µ, X̄ µ0 √
n σ/ n
p0 (1 − p0 ) p̂ − p0
p = p0 p, p̂ p0 √
n p̂(1−p̂)
n
µX − µY µX − µY , 2
σX σY2 X̄ − Ȳ − D
D + √
=D X̄ − Ȳ n m 2
σX σY2
n
+ m
p1 − p2 p1 − p2 , p1 (1−p1 )
p̂1 − p̂2 − D
D n √
=D p̂1 − p̂2 + m p2 (1−p2 )
p̂1 (1−p̂1 ) p̂2 (1−p̂2 )
n
+ m
22
Hypothesis testing, t-tests
Sample size n; X̄ − µ0
µ = µ0 unknown σ t= √ n−1
s/ n
Sample sizes n, m; X̄ − Ȳ − D
µX − µY = D unknown but equal t= √1 1
n+m−2
σX = σy sp n
+ m
23