Download One-Sample Hypothesis Testing in Biostatistics: t-Test and z-Test and more Study notes Biostatistics in PDF only on Docsity! Biostatistics Lecture 11 BIL 311 Lecturer: Dr. Patricia Buendia 1 Lecture 11 Outline Ch t 7 O l H th iap er – ne samp e ypo es s Testing One Sample t Test for the mean of a Normal Distribution with Unknown Variance: One Sided Alternatives (H1: μ > μ0 ) We compute , which follows a tn-1 distribution ns xt / 0μ−= We test the hypothesis H0: μ=μ0 vs. H1: μ > μ0 with a significance level α and we decide that: – If t>tn-1,1-α, then we reject H0 – If t≤tn-1 1-α, then we accept H0, with p=Pr(tn-1>t) Book page:237 5 One Sample t Test for the mean of a Normal Distribution with Unknown Variance: Two Sided Alternatives (H1: μ ≠ μ0 ) ns xt / 0μ−=We compute , which follows a tn-1 distribution We test H0: μ = μ0 vs. H1: μ ≠ μ0 with a significance level α and we decide that: – If |t|>tn-1,1-α/2, then we reject H0 – If |t|≤tn-1 1-α/2, then we accept H0, with [ ] ⎭ ⎬ ⎫ ⎩ ⎨ ⎧ >≤× ≤≤× = − 0)Pr(12 0),Pr(2 1 tiftt tiftt p n Book page:240 & 241 6 − − ,1n One Sample z Test for the mean of a Normal Distribution with known Variance: Two Sided Alternatives (H1: μ ≠ μ0 ) Use the z-test if the population σ is known and your sample size is large. n xz / 0 σ μ− =We compute , which follows a normal distribution We test H0: μ = μ0 vs. H1: μ ≠ μ0 with a significance level α and we decide that: – If |z|>z1-α/2, then we reject H0 – If |z|≤z1-α/2, then we accept H0 With p = 2Φ(z) if z ≤0 p=2(1 Φ(z)) if z>0 7 - Book page:244 Relationship between α and Confidence Intervals If you are comparing two means and H0: μ=μ0 H : μ≠μ ask yourself whether the 95%1 0, confidence interval for µ includes µ0. If the 95% CI includes µ0, then p>0.05 and H0 will be accepted, if not then p<0.05 and H0 will be rejected The rule works because 95%+5%=100% The rule works for all 100%×(1-α) CI 10Book page:259 & 260 Approximate p values - Y bt i i t l f 2 t il dou can o a n approx ma e p-va ues or a - a e test using the tables: For p=2×Pr(t ≤ 2 74)=24 . t24,0.99<|2.74|< t24,0.995 or equivalently 2 492 2 74 2 797 it th f ll th t. < . < . , en o ows a 0.005 < p/2 < 0.01 and 0.01 < p < 0.02 The exact P-value = TDIST(2.74,24,2)=0.011 Which is the approximate 2-tailed p value for 0 05 and a t 2 2 statistic with 60 α= . = . degrees of freedom 1. 0.05<p<0.1 2. 0.025<p<0.05 3. 0.02<p<0.05 4 0 01<p<0 02. . . One Sample Test for a binomial distribution: Normal-Theory Method The normal approximation to the binomial distribution is valid if np0q0 ≥ 5 We standardize⎯p: pp If z<zα/2 or z>z1 α/2, then nqp z o /0 0−= - H0 is rejected If zα/2 ≤ z ≤ z1-α/2, then H0 is accepted Book page:271 Two-sided alternative 15 One Sample Test for a binomial distribution: Normal Theory - Method Breast Cancer Example: We compute 3.1402.004.00 =−=−= ppz Because z1-α/2=z0.975=1.96 < z=14.3, H0 will 10000/)98.0(02.0/00 nqp be rejected Book page:272 16nqp ppz o /0 0−= One Sample Test for a binomial distribution: Normal Theory - Method Computation of the p-value: If⎯p<p0 then p-value = 2×Φ(z) If⎯p≥p0 then p-value = 2×(1-Φ(z)) Example: Because⎯p=0.04>0.02=p0, p-value=2×(1-Φ(14 3))<0 001 and. . the result is very highly significant. If np0q0<5 use the exact binomial test to calculate the p-value for a binomial hypothesis. (book p.273-274) Book page:272 17 The Power of a Test: one-sided z test Example: We would like to determine if mothers from a low socioeconomic status deliver babies with lower birthweight, given that a small sample (100) returned a mean birthweight of 115 oz with s=24 oz and nationwide μ =120 oz. A power of at least 80% is desired. ⎤⎡ − μμ )( 10 μ0=120, μ1=115, α=0.05,σ=24, n=100 and H0: μ=μ0, H1: μ=μ1< μ0 Power=Φ[z +(120 115)√100/24]= Φ[ 1 645+5(10)/24] ⎥⎦⎢⎣ +Φ nz σα α - - . =Φ(0.438)=0.669 There is about a 67% chance (the power of the test) of detecting a significant difference when =0 05 and n=100 α . . 20 From the power equation ⎥⎦ ⎤ ⎢⎣ ⎡ −+Φ nz μμα )( 10 you can see that σ 1 If α decreases z increases. , α and the power increases 2. If the difference in mean increases, the power decreases 3 If σ increases the power. increases 4. If n increases then the power increases 21 Factors Affecting the Power ⎤⎡ Notice from equation that power depends on 4 factors: | | ⎥⎦⎢⎣ − +Φ nz σ μμ α )( 01 α, μ1-μ0 , n, σ: 1 If α decreases z decreases and the power. , α decreases 2. If the difference in mean increases, the power increases 3. If n increases then the power increases 4 If i th d. σ ncreases e power ecreases. 22Book page:249 The Power of a Test: Sample Size Determination – One-sided tests From βσμμα −=−+Φ= 1)/||( 10 nzPower With H0: μ=μ0 H1: μ<μ0 We want to solve for n in terms of the other parameters and obtain: 110 /|| σμμ βα =−+ znz 2 2 11 2 )( )( μμ σ βα +=⇒ −− − zz n 25 10 − Book page:254 The Power of a Test: Sample Size Determination – One-sided tests 22 )( 2 10 11 )( μμ σ βα − + = −− zz n Back to the birthweight example: Suppose μ0 =120 oz, μ1 =115 oz, σ=24, α=0.05, 1-β=0.80 Compute the appropriate sample size needed to conduct the test: n=242(z0 95+z0 8)2/25=…=142.3 26 . . Book page:254 The Power of a Test: Sample Size Determination – Two-sided tests Th l i d d t d te samp e s ze nee e o con uc a two-sided test for H0: μ=μ0 H1: μ≠μ0 with i ifi d 1 βs gn cance α an power - : 2 12/1 2 )(σ βα + zz l i i 2 10 )( μμ − = −−n samp e s ze s larger because z1-α/2> z1-α! 27Book page:257