Prev: Char() vs substr() (was Re: How to - Hex IP address to dotted
Next: Robust standard errors in Zero inflated Poisson and Zero inflated
From: Robin R High on 1 Mar 2010 10:12 A few years ago -- a previous life, another location -- I looked into a modifying a formula from Fleiss, Chapter 4, and to include the FPC. *Enter the following; * desired values of alpha and power (e.g. alpha=.05 and power=.80) ; * N_pop = population size; * p1 = Proportion expected in Group 1; * p2 = Proportion expected in Group 2; DATA p_z; alpha=.05; power=.8; z_a=PROBIT((1-(alpha/2)) ); z_b=PROBIT(power); N_pop=5000; p1=.55; p2=.70; pb=(p1+p2)/2; OUTPUT; PROC PRINT DATA=p_z; RUN; * the following statements from PROC MODEL solve for the sample size nn; * This step computes sample size assuming an "infinite" population ; PROC MODEL DATA=p_z; (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)))) / (SQRT( ((p1*(1-p1)) + (p2*(1-p2)))/nn))) - z_b =0; SOLVE nn / out=roots2; run; quit; data roots2 ; SET roots2; nn=CEIL(nn); proc print data=roots2 NOobs; run; * gives nn = 163; * compare to PROC POWER (assumes infinite population); proc power; twosamplefreq test= lrchi groupproportions = (.55 .7) power = .8 Npergroup = . sides = 2; run; Computed N Per Group Actual N Per Power Group 0.801 163 * assuming you have N_pop and thus can enter the fpc = ((N_pop-nn)/N_pop) into the formula; PROC MODEL DATA=p_z; * computes sample size nn with the fpc included; (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)*((N_pop-nn)/N_pop)))) / (SQRT( ((p1*(1-p1)) + (p2*(1-p2)))/nn)*((N_pop-nn)/N_pop))) - z_b =0; SOLVE nn / out=roots3; run; quit; proc print data=roots3 NOobs; run; gives nn = 156 Robin High UNMC From: Bminer <b_miner(a)LIVE.COM> To: SAS-L(a)LISTSERV.UGA.EDU Date: 02/26/2010 05:38 PM Subject: FPC Sample Size Power? Sent by: "SAS(r) Discussion" <SAS-L(a)LISTSERV.UGA.EDU> Hi all, Is there any way (SAS or otherwise) to determine the required sample size to test the difference in two means or proportions for a given power, given a finite population? In other words, say we have a sample frame of X people and I want to test a control versus a treatment. Short of 50/50 split, how can I allocate subjects to the treatment or control to reach my required power? Thanks!
From: Bminer on 1 Mar 2010 12:41 On Mar 1, 10:12 am, rh...(a)UNMC.EDU (Robin R High) wrote: > A few years ago -- a previous life, another location -- I looked into a > modifying a formula from Fleiss, Chapter 4, and to include the FPC. > > *Enter the following; > * desired values of alpha and power (e.g. alpha=.05 and power=.80) ; > * N_pop = population size; > * p1 = Proportion expected in Group 1; > * p2 = Proportion expected in Group 2; > > DATA p_z; > alpha=.05; power=.8; > z_a=PROBIT((1-(alpha/2)) ); z_b=PROBIT(power); > N_pop=5000; > p1=.55; > p2=.70; > pb=(p1+p2)/2; OUTPUT; > > PROC PRINT DATA=p_z; RUN; > > * the following statements from PROC MODEL solve for the sample size nn; > * This step computes sample size assuming an "infinite" population ; > > PROC MODEL DATA=p_z; > (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)))) / (SQRT( ((p1*(1-p1)) + > (p2*(1-p2)))/nn))) - z_b =0; > SOLVE nn / out=roots2; > run; quit; > > data roots2 ; SET roots2; nn=CEIL(nn); > proc print data=roots2 NOobs; run; > > * gives nn = 163; > > * compare to PROC POWER (assumes infinite population); > > proc power; > twosamplefreq > test= lrchi > groupproportions = (.55 .7) > power = .8 > Npergroup = . > sides = 2; > run; > > Computed N Per Group > > Actual N Per > Power Group > > 0.801 163 > > * assuming you have N_pop and thus can enter the fpc = ((N_pop-nn)/N_pop) > into the formula; > > PROC MODEL DATA=p_z; > * computes sample size nn with the fpc included; > (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)*((N_pop-nn)/N_pop)))) / (SQRT( > ((p1*(1-p1)) + (p2*(1-p2)))/nn)*((N_pop-nn)/N_pop))) - z_b =0; > SOLVE nn / out=roots3; > run; quit; > > proc print data=roots3 NOobs; run; > > gives nn = 156 > > Robin High > UNMC > > From: > Bminer <b_mi...(a)LIVE.COM> > To: > SA...(a)LISTSERV.UGA.EDU > Date: > 02/26/2010 05:38 PM > Subject: > FPC Sample Size Power? > Sent by: > "SAS(r) Discussion" <SA...(a)LISTSERV.UGA.EDU> > > Hi all, > > Is there any way (SAS or otherwise) to determine the required sample > size to test the difference in two means or proportions for a given > power, given a finite population? In other words, say we have a sample > frame of X people and I want to test a control versus a treatment. > Short of 50/50 split, how can I allocate subjects to the treatment or > control to reach my required power? > > Thanks! Thanks Robin! Is it correct to say that in order to use the FPC, you *simply* multiply the standard error of the statistics by this correction ratio?
From: Robin R High on 3 Mar 2010 09:33
From: Bminer <b_miner(a)LIVE.COM> To: SAS-L(a)LISTSERV.UGA.EDU Date: 03/01/2010 07:26 PM Subject: Re: FPC Sample Size Power? Sent by: "SAS(r) Discussion" <SAS-L(a)LISTSERV.UGA.EDU> On Mar 1, 10:12 am, rh...(a)UNMC.EDU (Robin R High) wrote: > A few years ago -- a previous life, another location -- I looked into a > modifying a formula from Fleiss, Chapter 4, and to include the FPC. > > *Enter the following; > * desired values of alpha and power (e.g. alpha=.05 and power=.80) ; > * N_pop = population size; > * p1 = Proportion expected in Group 1; > * p2 = Proportion expected in Group 2; > > DATA p_z; > alpha=.05; power=.8; > z_a=PROBIT((1-(alpha/2)) ); z_b=PROBIT(power); > N_pop=5000; > p1=.55; > p2=.70; > pb=(p1+p2)/2; OUTPUT; > > PROC PRINT DATA=p_z; RUN; > > * the following statements from PROC MODEL solve for the sample size nn; > * This step computes sample size assuming an "infinite" population ; > > PROC MODEL DATA=p_z; > (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)))) / (SQRT( ((p1*(1-p1)) + > (p2*(1-p2)))/nn))) - z_b =0; > SOLVE nn / out=roots2; > run; quit; > > data roots2 ; SET roots2; nn=CEIL(nn); > proc print data=roots2 NOobs; run; > > * gives nn = 163; > > * compare to PROC POWER (assumes infinite population); > > proc power; > twosamplefreq > test= lrchi > groupproportions = (.55 .7) > power = .8 > Npergroup = . > sides = 2; > run; > > Computed N Per Group > > Actual N Per > Power Group > > 0.801 163 > > * assuming you have N_pop and thus can enter the fpc = ((N_pop-nn)/N_pop) > into the formula; > > PROC MODEL DATA=p_z; > * computes sample size nn with the fpc included; > (((ABS(p2-p1)) - (z_a*SQRT(2*(pb*(1-pb)/nn)*((N_pop-nn)/N_pop)))) / (SQRT( > ((p1*(1-p1)) + (p2*(1-p2)))/nn)*((N_pop-nn)/N_pop))) - z_b =0; > SOLVE nn / out=roots3; > run; quit; > > proc print data=roots3 NOobs; run; > > gives nn = 156 > > Robin High > UNMC > > From: > Bminer <b_mi...(a)LIVE.COM> > To: > SA...(a)LISTSERV.UGA.EDU > Date: > 02/26/2010 05:38 PM > Subject: > FPC Sample Size Power? > Sent by: > "SAS(r) Discussion" <SA...(a)LISTSERV.UGA.EDU> > > Hi all, > > Is there any way (SAS or otherwise) to determine the required sample > size to test the difference in two means or proportions for a given > power, given a finite population? In other words, say we have a sample > frame of X people and I want to test a control versus a treatment. > Short of 50/50 split, how can I allocate subjects to the treatment or > control to reach my required power? > > Thanks! Thanks Robin! Is it correct to say that in order to use the FPC, you *simply* multiply the standard error of the statistics by this correction ratio? I don't have Cochran's "Sampling Techniques" book at hand (where I first learned of it) but that is the gist of the formula for estimating proportions. Robin High UNMC |