Sta$s$cal Inference STAT 431
Lecture 9: Inferences for Two Samples (I)
Example: Pfizer’s Hypothesis Tes$ng
• The molecule cGMP is a natural vasodilator: it increases blood flow by relaxing muscle in the walls of blood vessels
• In human bodies, phosphodiesterase inac$vates cGMP
• The drug sildenafil inhibits phosphodiesterase
sildenafil
(inac$ve product of cGMP)
phosphodiesterase
Blood vessel
cGMP
STAT 431
2
Something unexpected comes up…
• 1980s: Pfizer develops sildenafil citrate, which inhibits phosphodiesterase, hoping to increase blood flow in the coronary arteries of individuals with heart disease
• 1991: Phase I clinical trials are begun
• 1992: Pfizer gets reports of an unexpected “side effect” in men
• 1994: AUer sildenafil fails to show any cardiac benefit, Pfizer begins pilot studies for treatment of erec$le dysfunc$on (ED)
• 1998: FDA approves sildenafil, marketed as Viagra, for ED
STAT 431 3
Pfizer’s Hypothesis Tes$ng (Cont’d)
• Based on Pfizer’s main publica$on describing Viagra’s effec$veness:
Goldstein I, Lue TF, Padma-Nathan H, Rosen RC, Steers WD, Wicker PA; Sildenafil Study Group. Oral sildenafil in the
treatment of erec$le dysfunc$on. N Engl J Med 1998; 338:1397-1404, May 14, 1998
• Men with diagnosed ED who were in stable rela$onships were assigned to either placebo (n=199) or 100mg sildenafil (n=101) for 24 weeks. Each was instructed to take his respec$ve pill one hour before agemp$ng sexual intercourse.
• The men were asked, both before and aUer the study, how oUen they were able to successfully achieve penetra$on. The response op$ons were on a scale from 1 (almost never or never) to 5 (almost always or always).
• We want to know whether Viagra’s effec$veness is different from that of placebo. How can we frame this in terms of a hypothesis test?
STAT 431 4
Hard Evidence
• μ = average change in score aUer 24 weeks for an untreated man in popula$on from which subjects were drawn
• μ = average change for a treated man in that popula$on :μ =μ
:μ =μ
n
Average change from baseline
Standard error (SE) of change
placebo
199
+0.1
0.2
sildenafil
101
+2.0
0.2
STAT 431 5
Basic Sta$s$cal Selng
• Two random samples (independent samples design) – Two popula$ons F1 and F2
• With popula$on means μ1 and μ2
• With popula$on standard devia$ons σ1 and σ2
– Independent samples with sample sizes n1 and n2 from F1 and F2 ,
respec$vely
• X1,…Xn1 ∼ F1 independent of Y1,…Yn2 ∼ F2
– Summarysta$s$csfromthesamples • Sample means X ̄ and Y ̄
• Sample SD’s S1 and S2
• Primary goal: comparing the two popula$on means
– Confidence intervals for the difference μ1 − μ2
– TestsofH0 :μ1 =μ2 vs.H1 :μ1 =μ2 [orofH0 :μ1 ≤μ2,orofH0 :μ1 ≥μ2]
• Note: the hypotheses could also be expressed in terms of the difference μ1 − μ2 STAT 431 6
iid
iid
•
Es$ma$on of The Difference Fact: X ̄ − Y ̄ is a good es$mator of the difference μ1 − μ2
•
If σ12, σ2 are unknown, we es$mate them using S12, S2
Denote the es$mator by S2 [see next page for the actual es$mator]
– Bias: E(X ̄ −Y ̄)=μ1 −μ2,sounbiased σ2 σ2
σ2 σ2 1 + 2
– Variance:Var(X ̄−Y ̄)= 1 + 2 ,soSD(X ̄−Y ̄)= n1 n2
n1 n2
– When σ12 = σ2 = σ2 , we pool informa$on from both samples to es$mate σ2
S2 S2 SD(X−Y)= n +n
̄ ̄
12
– When σ12 = σ2 , we es$mate them separately by S12 and S2 , and ̄ ̄ S12 S2
STAT 431 7
SD(X−Y)= n +n 12
Pooled Variance Es$mator
• Pooled variance es$mator
– Twoindependentsamplesfromtwopopula$ons
– The two popula$ons have equal variances σ12 = σ2 = σ2 – Sample SD’s for the two samples are S12 and S2
– Formulaforpooledvariancees$mator
S2 = (n1 −1)S12 +(n2 −1)S2 n1 +n2 −2
nn 11 2
= n1 +n2 −2 (Xi −X ̄)2 + (Yi −Y ̄)2 i=1 i=1
STAT 431
8
Comparing Means: Large Samples
• Basic setup
– Tworandomsamples
– The sample sizes n1 and n2 are large [both n1 , n2 ≥ 30] – Assume σ12 and σ2 are known
[if not, use s21 and s2 to subs$tute, ligle difference for large samples]
• Pivotal random variable for μ1 − μ2
( X ̄ − Y ̄ ) − ( μ 1 − μ 2 ) d
Z = σ12/n1 +σ2/n2 ≈N(0,1)
– Defini$ondependsonlyontheparameterofinterest,i.e.,μ1−μ2 [not μ1 or μ2 per se!]
– Itsdistribu$onisfreeofunknownparameters
STAT 431 9
• Construc$ng 100(1 − α)% CI for μ1 − μ2
[x ̄ − y ̄ − zα/2σ12/n1 + σ2/n2, x ̄ − y ̄ + zα/2σ12/n1 + σ2/n2 ]
– Centered at x ̄ − y ̄
– Halfwidth= zα/2×SD(X ̄−Y ̄)
• TestforH0 :μ1 −μ2 =δ0 vs. H1 :μ1 −μ2 =δ0
– Observed test sta$s$c:
– P-value: P (|Z| ≥ |z|) = 2[1 − Φ(|z|)]
– Decision rule for level α test: we reject H0 if P-value<α ⇔ |z|>zα/2 ⇔ |x ̄−y ̄−δ0|>zα/2
• See p.274 of the textbook for tests for one sided hypotheses STAT 431
σ12/n1 +σ2/n2
z = ( x ̄ − y ̄ ) − δ 0 σ12/n1 + σ2/n2
10
Example: Bumpus’ Data on Natural Selec$on
• Data collected by Hermon Bumpus in 1898: measurements of humerus (arm bone) lengths on house sparrows aUer a severe winter storm
• 24 of the birds perished, 35 survived
!
!
PERISHED
SURVIVED
(Photo from Wikipedia)
Scien$fic Ques$on
Did those perished birds lack physical characteris$cs enabling them to withstand the intensity of this par$cular natural selec$on process?
11
Side-by-side box plots for arm bone length (in 1/1000 inch)
STAT 431
humerus length
660 680 700 720 740 760 780
Comparing Means: Small Samples – Twoindependentsamplesfromnormalpopula$ons
• Basic setup
– The sample sizes n1 and/or n2 are small
• Three different scenarios
1. σ12 and σ2 known
• The inference procedures are the same as the large sample case
2. σ12 and σ2 unknown, but are equal, i.e., σ12 = σ2 = σ2
3. σ12 and σ2 unknown, and do not assume equal variance
Cases of primary interest
STAT 431
12
Pivotal Random Variables for • Unknown equal variance: σ12 = σ2 = σ2
– Es$mator for σ2 : pooled variance es$mator
S2 = (n1 −1)S12 +(n2 −1)S2
μ−μ 1iiiiiiii2i
– Distribu$on of S2:
– Pivotalrandomvariable:
n1 +n2 −2 (n1 +n2 −2)S2 2
σ2 ∼ χn1+n2−2 ( X ̄ − Y ̄ ) − ( μ 1 − μ 2 )
T = S1/n1 + 1/n2 ∼ tn1+n2−2 STAT 431
13
• Unknown variances without equal variance assump$on
– Es$mate σ12 by S12 , and σ2 by S2
– Candidate pivotal random variable: X ̄ − Y ̄ − (μ1 − μ2)
T = S12/n1 + S2/n2
– Bad news: its distribu$on depends on the ra$o σ12/σ2 of the unknown
variancesèNOT a pivotal r.v.
– Goodnews:itsdistribu$oncanbewellapproximatedbyaStudent’st
distribu$on with d.f. = ν
• See Eq.(8.11) of p.280 for the defini$on of ν [no need to remember]
• Es$mated from data, a func$on of the sample SD’s and the sample sizes
– Howlargeisν?min(n1,n2)−1≤ν≤n1+n2−2
– Conclusion: (X ̄−Y ̄)−(μ1−μ2) d
T= S12/n1+S2/n2 ≈tν
STAT 431 14
Confidence Intervals for μ1 − μ2ii(Unknown σ1 , σ2)iiiiiii • With equal variance assump$on
̄ ̄ ̄ ̄ X − Y ± tn1+n2−2,α/2SD(X − Y )
=X ̄−Y ̄±tn1+n2−2,α/2S 1 + 1 n1 n2
• Without equal variance assump$on
̄ ̄ ̄ ̄
X −Y ±tν,α/2SD(X −Y)
̄ ̄ S12S2 =X−Y±tν,α/2 n +n
12
• CI’s in both cases are of the same form:
estimator ± const. × SD(estimator)
• Difference: (1) cri$cal values come from t-distribu$on with different d.f. (2) different es$mators of SD of the es$mator
STAT 431 15
Example: Bumpus’ Data on Natural Selec$on
Summary Sta$s$cs
95% CI for the average arm bone length difference between the survived group and the perished group
mean SD
Sample size
Normal Q−Q Plot
Perished Survived 727.9 738 23.54 19.84
35 24
Normal Q−Q Plot
•
Assume σ12 = σ2
– d.f.=35+24–2=57 – Confidenceinterval
[-1.28, 21.45]
Do not assume σ12 = σ2
– d.f.≈44
– Confidenceinterval
[-1.73, 21.89]
– Notethatit’swiderthanthecase
•
!
!
!! !!
! !
!!
!!! !!!!!
! !
!
!! !!
!! !!!
!
! !!!!
! !!
!!
! !!!!! !
!! !
! !
!
!
−2 −1 0 1 2 Theoretical Quantiles
−2 −1 0 1 2 Theoretical Quantiles
with equal variance assump$on
! !!
!
STAT 431
16
Sample Quantiles
−3 −2 −1 0 1
Sample Quantiles
−2 −1 0 1 2
Equal Variance Assump$on
• When sample sizes are equal, the pooled t-test is fairly robust to unequal variances
• When sample sizes are unequal, the pooled t-test is typically not valid for unequal variances; the unpooled t-test is a robust alterna$ve
STAT 431 17
n1 = 50 Normal
μ1 =0 !12 =1
T= X!Y ~tn1+n2!2 S 1+1
n1 n2
n2 =50 Normal
μ2 =0 !2 =9
STAT 431
18
n1 = 50 Normal
μ1 =0 !12 =1
T= X!Y ~tn1+n2!2 S 1+1
n1 n2
n2 = 500 Normal
μ2 =0 !2 =9
STAT 431
19
n1 = 500 Normal
μ1 =0 !12 =1
T= X!Y ~tn1+n2!2 S 1+1
n1 n2
n2 =50 Normal
μ2 =0 !2 =9
STAT 431
20
T= X!Y ~t!
S12 1+
n1
S2 n2
n =50
n =500
2
Normal
Normal
μ1 =0 !12 =1
μ2 =0 !2 =9
STAT 431
21
• Key points for this class
– Independentsamplesdesign
– Comparingthemeansoftwopopula$ons
• Large samples
• Small normal samples, known SD’s
• Small normal samples, unknown equal SD’s: pooled es$mator for variance
• Small normal samples, unknown SD’s: es$mated d.f. for the t-distribu$on
• Reading: Sec$ons 8.1 & 8.3 of the textbook
• Next class: Inferences for two samples (II) (Sec$ons 8.1 & 8.3)
STAT 431 22