One Sample TestsBios 662Michael G. Hudgens, [email protected]://www.bios.unc.edu/∼mhudgens2007-08-31 17:05BIOS 662 1 One Sample TestsOutline• Small sample, Normal• Large sample• Nonparametric– Sign test– Wilcoxon signed rank testBIOS 662 2 One Sample TestsApplications• Prevalence study: collect data to test a hypothesis aboutmean or median of Y• Paired data:Eg Before-after study where measure characteristic be-fore and after treatment; twinsBIOS 662 3 One Sample TestsSmall Sample, Normal• For small sample and Y ∼ N(µ, σ2),• Form previous lecture, test statistict =¯Y − µ0s/√n∼ tn−1• For two-sided alternative HA: µ 6= µ0, critical regionCα= {t : |t| > tn−1,1−α/2}• For one-sided alternative HA: µ > µ0, critical regionCα= {t : t > tn−1,1−α}BIOS 662 4 One Sample TestsSmall Sample, Normal• P-value: probability of obtaining test statistic as ormore extreme than observed from the sample• For two-sided alternative HA: µ 6= µ0,p = Pr[T ≤ −|t|] + Pr[T ≥ |t|]where T ∼ tn−1. Equivalentlyp = 2 Pr[T ≤ −|t|] = 2 Pr[T ≥ |t|]• For one-sided alternative HA: µ > µ0,p = Pr[T ≥ t]BIOS 662 5 One Sample TestsSIDS Example• Example: text page 281; problem 8.2• It is hypothesized that babies that die of SIDS are dif-ferent weight than babies who do not die of SIDS.• A study of 22 dizygotic twins compared the birthweightof the baby who died with the baby who did not die.• The data are given in the text.BIOS 662 6 One Sample TestsSIDS Example• Example: text page 281; problem 8.2• Let our random variable Y equal the weight of SIDSbaby (twin) minus weight of non-SIDS baby (twin)H0: µdiff= 0HA: µdiff6= 0BIOS 662 7 One Sample TestsSIDS Example•¯y = 0.1818, s = 369.57, n = 22t =¯ys/√n= 0.0023• Critical region at α = 0.05C.05= {t : |t| > t21,.975= 2.08}• P-valuep = 2 ∗ Pr[T ≤ −0.0023] = 0.9982BIOS 662 8 One Sample TestsExample: R• R> t.test(sid.diffs)One Sample t-testdata: sid.diffst = 0.0023, df = 21, p-value = 0.9982alternative hypothesis: true mean is not equal to 0> t.test(sid.diffs,alternative="greater")One Sample t-testdata: sid.diffst = 0.0023, df = 21, p-value = 0.4991alternative hypothesis: true mean is greater than 0BIOS 662 9 One Sample TestsExample: SAS• SASProc ttest; var diff;T-TestsVariable DF t Value Pr > |t|diff 21 0.00 0.9982BIOS 662 10 One Sample TestsSmall Sample• t test assumptions:– Observations are independent– Sample is from (the same?) normal distributionBIOS 662 11 One Sample TestsLarge Sample• For large sample, use normal approximation (CLT):¯Y ∼ N(µ,σ2n)Z =¯Y − µs/√napprox N(0, 1)• Approximation improves as n → ∞• Note: Y ’s do not need to be normally distributedBIOS 662 12 One Sample TestsLarge Sample• Example: Iron deficiency• Iron deficiency anemia is an important nutritional healthissue.• A study of 63 boys aged 9-11 from families with incomebelow the poverty level was conducted.• The mean daily iron intake in the U.S. population isknown to be 14.45 mg.• Q: Is iron deficiency in boys associated with family in-come?BIOS 662 13 One Sample TestsLarge Sample• Example: Iron deficiency (continued)H0: µ = 14.45; HA: µ 6= 14.45C.05= {z : |z| > 1.96}¯y = 12.5; s2= 22.5625; n = 63z =12.5 − 14.45p22.5626/63= −3.26• Reject H0BIOS 662 14 One Sample TestsTesting/Estimation: Large Sample• Testing H0: µ = 0 versus HA: µ 6= 0Cα= {z : |z| > z1−α/2}wherez =¯y − µ0s/√n• Estimation: confidence interval for µ¯y ± z1−α/2s√n• Can show: R ejec t H0iff CI excludes µ0BIOS 662 15 One Sample TestsTesting/Estimation: Large Sampleµµ0y(1 −− αα)% CIµµ0yNon−rejection regionµµ0−− z1−−αα 2s n µµ0++ z1−−αα 2s ny −− z1−−αα 2s n y ++ z1−−αα 2s nBIOS 662 16 One Sample TestsTesting/Estimation: Large Sample• Theorem: Reject H0iff CI excludes µ0• Sketch of proof: Suppose CI excludes µ0ieµ0/∈ [¯y − z1−α/2s√n,¯y + z1−α/2s√n]Without loss of generality, assumeµ0<¯y − z1−α/2s√n,This impliesz1−α/2<¯y − µ0s/√n≡ zimplying z ∈ Cα BIOS 662 17 One Sample TestsTesting/Estimation• Equivalent; two sides of the same coin• See text Section 4.7• Emphasize testing be forehand (to inform power, samplesize calculations) and estimation afterwardBIOS 662 18 One Sample TestsSmall Sample, Non-normal• Transformation, bootstrap• Nonparametric tests:– Sign test– Wilcoxon signed rank test• Read van Belle et al 8.1-8.5BIOS 662 19 One Sample TestsSign Test• Suppose Y1, . . . , Yniid continuous F with median ζ.5• Hypothese sH0: ζ.5= ζ.5,0(median=some value)HA: ζ.56= ζ.5,0• If the true median is ζ.5,0and F continuous,Pr[Y < ζ.5,0] = Pr[Y > ζ.5,0] = .5for a randomly selected observation YBIOS 662 20 One Sample TestsSign Test• Let R be the number of obs > ζ.5,0• Under H0R ∼ Bin(n, .5)Pr[R ≤ r] =rXi=0ni12i1 −12n−i=12nrXi=0niBIOS 662 21 One Sample TestsSign Test• Critical regionCα= {r : r ≤ rα/2or r ≥ r1−α/2}where rα/2and r1−α/2are such thatPr[R ≤ rα/2|H0] + Pr[R ≥ r1−α/2|H0] ≤ αBIOS 662 22 One Sample TestsSign Test• Since Bin(n, .5) is symmetric, r1−α/2= n − rα/2• Thus need rα/2such that12nrα/2Xi=0ni≤α2• Choose largest rα/2such that this inequality holds; why?• For n = 10, the critical region for a 2-sided test of sizeα = 0.05 is C.05= {0, 1, 9, 10}BIOS 662 23 One Sample TestsSign Test• CDF for Binomial(n = 10, π = .5)Cumulativer Probability0 .00101 .01072 .05473 .17194 .37705 .62316 .82827 .94538 .98939 .999010 1.0000BIOS 662 24 One Sample TestsSign Test: ExampleExample: Calcium supplementation in African-American mentreatment before after diff1. calcium 107 100 -72. calcium 110 114 43. calcium 123 105 -184. calcium 129 112 -175. calcium 112 115 36. calcium 111 116 57. calcium 107 106 -18. calcium 112 102 -109. calcium 136 125 -1110. calcium 102 104 2BIOS 662 25 One Sample TestsSign Test: Example• TestingH0: ζ.5= 0 versus HA: ζ.56= 0• For n = 10 and α = 0.05, C.05= {0, 1, 9, 10}• r = 4 is not in C.05; do not reject H0• P-value2 ×12104Xi=010i= 0.754BIOS 662 26 One Sample TestsSign Test: Example• R code> 2*sum(dbinom(0:4,10,.5))[1] 0.7539063> 2*pbinom(4,10,.5)[1] 0.7539063> library("BSDA")> sign.test(diff)One-sample Sign-Testdata: diffs = 4, p-value = 0.7539alternative hypothesis: true median is not equal
View Full Document