Confidence Interval and Hypothesis Testing: Iv An Andr Es Trujilllo Abella
Confidence Interval and Hypothesis Testing: Iv An Andr Es Trujilllo Abella
pujshield-eps-converte
Aim
Get a range of admissible values for our parameter.... Θ
read it
With 99% confidence Θ will be inside our estimated confidence interval...
pujshield-eps-converte
pujshield-eps-converte
Confidence level
1 − α, α ∈ (0, 1) (2)
Significance level of α.
pujshield-eps-converte
Given α we are searching two values (under and above) of zero (remember
that is Z ) that:
...
Zα
Z1− α2
The area between −Z1− α2 and Z1− α2 is equal to α
pujshield-eps-converte
...
!
(x̄ − µ)
P −Z1− α2 ≤ ≤ Z1− α2 =1−α (3)
√σ
n
General
Θ̂ ± Margin of error (5)
Where Θ̂ is our best estimator.
There is a importaint point here, is that condifence interval rely on in the
distrbution of Θ̂.
...
Θ̂ ± Z1− α2 S.E (Θ̂) (6)
pujshield-eps-converte
...
If a interval is very wide then not is informative!
pujshield-eps-converte
pujshield-eps-converte
...
S S
x̄ − t(1− α2 ,n−1) √ , x̄ + t(1− α2 ,n−1) √ (8)
n n
where tn−1 comes from t distribution with n degrees of freedom.
Paired data
Two measurement of a same individual after a treatment.
...
Sd S
x̄d − t(1− α2 ,n−1) √ , x̄d + t (1− α ,n−1) √d (10)
n 2 n
where tn−1 comes from t distribution with n degrees of freedom, a where y
is our variable of interest in dataset and therefore
n
1X
x̄d = ypost,i − ypre,i (11)
n pujshield-eps-converte
i=1
Two approaches
Pooled σA2 = σB2
Unpooled σA2 ̸= σB2
Uses SA and SB as approximations to see what approach is better.
pujshield-eps-converte
SE Unpooled
s
σA2 σ2
SE = + B (12)
nA nB
Remember that in most practical applications we don’t know σ then
replace it with S.
...
used t distribution to estimate the area:
Uses Welchs approximation (See this reference)
or min(nA − 1, nB − 1) pujshield-eps-converte
ESE pooled
q
(nA − 1)SA2 + (nB − 1)SB2
r
1 1
+ (13)
nA + nB − 2 nA nB
Excersice
Construct a program to calcualte pooled and unpooled intervals.
pujshield-eps-converte
...
CI(mean) simulation
CI(mean) real data
pujshield-eps-converte
First
Central limit theorem
pujshield-eps-converte
...
given that limits are random the interval is random
...
Seeing-theory
pujshield-eps-converte
pujshield-eps-converte
pujshield-eps-converte
pujshield-eps-converte
Xn ∼ N(µ, σ 2 ), then
x̄ − µ
∼ N(0, 1) (15)
√σ
n
x̄ − µ
P(−1.96 ≤ ≤ 1.96) = 0.95 (16)
√σ
n
pujshield-eps-converte
P
xi
P̂ = (18)
n
where xi is the number of successes, therefore using the central limit
theorem we have that
P̂ − P
q ∼ N(0, 1) (19)
P̂(1−P̂)
n
Interval
s s
P̂ − Z1− α P̂(1 − P̂) P̂(1 − P̂)
, P̂ + Z1− α2 (20)
2 n n
pujshield-eps-converte
...
Analize how chante the results for α = 0.01
pujshield-eps-converte
pujshield-eps-converte
...
CI(proportion) simulation
CI(proportion) real data
pujshield-eps-converte
pujshield-eps-converte
...
s
P̂A (1 − P̂A ) P̂B (1 − P̂B )
SE (P̂A − P̂B ) = + (23)
nA nB
Exercise
With the following Dataset determine the confidence interval for proportion
difference among Males and Females whose score in any module pujshield-eps-converte
is in Q3 .
pujshield-eps-converte