Download Power Computation in SAS: One-Sample and Two-Sample Hypothesis Tests and more Study notes Statistics in PDF only on Docsity! ---- 3/1/61 (j) p J],?e (OLI<-T C-A,:;!) i2e. (t/>f4/J:./'dM -fu, 6Yle U / (/-51'0&/) f( y ( fenp C{ PC V 't C f f-I A iuu ) -- r-F WJ//ig. ''u-rt " p( Y >4r + Y o(r ILJ ) o 00/ lilt 7 0 = cy P( y f J9- //-i ) - /-;J A . ::'aN-piR .)/"e t!fl<'I'JJ,',m lUi 0Jtg M) (5 +f : At c= dr V'S . I-k '0 ;> At." ((- 10&1 ) co T.uJ Lei i !J-<.-eS a." i - a.J)" Yl1 0lJL Cr=<-raX 1/ . e( Y ) LIt-{ tuJ) =- f ( Y- A 0 ? 3:--41 IH o s/-fil (5/f7t () "0=- -f ( to >$ )= cY 7' c.. Ala -f- ilJ',"_/Y?J ) ,.---- ----- :5 / Q/01 (j) {tfl Ar4 : P y>Ar.J--tq-,j7lc.J = r -44 ;=; f ( > AT., (V7:-t) J P(-t > - ;- /-;1 3/-r;,.. : -t_ i . 01 I/!» J? -/ crj Y/ -(- ?4'n OM.J <' V\ " ;;; 6"\- s;cf.v::, of u.dJl-l, , Vl (3 (t<r,H )7- f!hu- v-f-h <0'\. V!.- f ... 0) W.. YiJ2Rd a- -101. S) oHb4'l tf/V!'UQ I/>'WI a ;J,y/slu/y, I) J WYhJ2. UA- 0vV l) ClA-t tI sluvl b!J U<:J / :t -v hid) "" (S ()'<Y - 31:6) ') 2- d 2) i.M1hnown t5 2/0VV'1JCL h c>J ::0 ( - 6 , V/"'-{S{ier, '(l,.,-,;'t r )L ( 3) +0"4'- It.... 2-\ i:Y @ 2009-03-08 ############################### one-sample hypothesis test ############################# alpha=0.05 beta=O.lO #(gives power of 90%) ('r\. 0 =:. 4 m.A.:(p '" =3 ## Get initial n based on a known sigma: n.O=( (s*(qnorm(alpha,lower.tail=FALSE)-qnorm(l-beta,lower.tail=FALSE)))/(m.A-m.O) )A2 n.O # [lJ 19.26866 ## Utilize sample size equation for unknown sigma to get next n. n.1=((s*(qt(alpha,n.0-1,lower.tail=FALSE)-qt(1-beta,n.0-l,lower.tail=FALSE)) )/(m.A-m.O) )A2 n.1 #[lJ 21.10018 n.old=n.O n.new=n.1 while (abs(n.old-n.new»=l) { n.old=n.new n.new=( (s*(qt(a1pha,n.old-1,lower.tail=FALSE)-qt(1-beta,n.old-l,lower.tail=FALSE) ))/(m.A-m 0) ) A2 print(n.new) } #[lJ 20.92262 Use n=21 as your sample size. W iJJ vJ. +. u iDW ct. Ju.-/ /V ,I-en-th!PowhL/ try C\:: 6.,;$ ) ff)w-t1..-= ) S=3 J At 4 ::: 2 ) rYne--la./·/J -tuJ. (NY;WY11YY ) - 1/1 - SAS statements for sample size computation, one-sided test for difference of means, unknown sigma: proc power; twosamplemeans test=diff sides=U meandiff=2 stddev=l power=0.90 npergroup=. run; The POWER Procedure Two-sample t Test for Mean Difference Fixed Scenario Elements Distribution Normal Method Exact Number of Sides U Mean Difference 2 Standard Deviation 1 Nominal Power 0.9 Null Difference o Alpha 0.05 Computed N Per Group Actual N Per Power Group 0.942 6 2 SAS statements for power computation, two-sided test for difference of means, unknown sigma: /*Use it to compute power for a given scenario with 2-sided test.*/ proc power; twosamplemeans test=diff sides=2 meandiff=1 2 3 stddev=1 npergroup=5 6 7 power=. run; The POWER Procedure Two-sample t Test for Mean Difference Fixed Scenario Elements Distribution Normal Method Exact Number of Sides 2 Standard Deviation 1 Null Difference 0 Alpha 0.05 Computed Power Mean N Per Index Diff Group Power 1 1 5 0.286 2 1 6 0.347 3 1 7 0.406 4 2 5 0.791 5 2 6 0.876 6 2 7 0.929 7 3 5 0.985 8 3 6 0.996 9 3 7 >.99 3 ---------,---- tl'l;, C-Tf.n 'I: ?cJ/-lA;,d'-/i, si «e U-< ? fl; -=: h rf;n J.f )') Vl -=0 l-t"';;: "'}IIL S f'" L (l; 7 w ;-Jt,. N no- • \ 2- lZ [1]--- Ij - {([l wU pow-'-"- +:c "'- t\ -W4y AN<lV4 nJ- Lb) 151. f - " ? 3S7l'TAL- (4-( ) c - M t -Ct.e-JU2 o F . (cr ") - I ., tJ ) ¢ =- 0 ') t J -1I- +.c J:t-.A rd o.Jq.-: W(J a. b p&W-br.? 4s 41way5) 10 ) -&uu 0-/ Ih · 0;fh "a q ttM rYIif';l 4- +k jJVClM5 1-/0 (p rLu 1-1/+ (u. It, Ia-b )) F F ./J /'1. " J) N-q) ¢) w,'f?t If >0 lwkuu F a Wkd ¢? A" _ hI q/. 2- - ( q. ( r {)L- La.-tY'-- + e.aV ,;;., VVLR Cu-t S I nrv,'h a ¢ ;r-ov;d.v» a 1wJ) T{ '3 -, W It, o AI::: _ r (i) AI := 0 At2- -= 0 /ttL = 0 /tr 3 :: I 'If' = J1 ) 3 2- '2 fI.. -:::: h.L --0' ¢ = h I (Ar,' - %)If J -::.., / / (5'L