BookmarkSubscribeRSS Feed
msecic
Calcite | Level 5

SAS v9.4. Can I use proc power - onesamplefreq to calculate sample size for a single proportion performance goal hypothesis? I want to show success rate is at least 81%.  I expect the sample to show 90% success and want sample size to ensure the lower limit of the one-sided 95% confidence interval is at least 81% (alpha=5%, power=80%).  Help!  Is this correct?

 


proc power ;
onesamplefreq 
sides=1
alpha=0.05
nullproportion=0.81 /*Performance Goal-PG*/
proportion= 0.90  /*must be slightly higher then PG*/
ntotal= .
power= .8 ;
run;

4 REPLIES 4
PGStats
Opal | Level 21

In my version of SAS (9.4 TS l 1M1) only the normal approximation to the binomial distribution is available.

 

You must add options

 

method=normal
test=adjz

 

to get ntotal.

PG
msecic
Calcite | Level 5

Thank you very much!  So the rest of the code is set up accurately for the study objective?

PGStats
Opal | Level 21

I think so!

PG
FreelanceReinh
Jade | Level 19

@msecic: I think you should first decide which confidence interval you want to compute. Your code uses the default, which is the exact binomial test, corresponding to the exact Clopper-Pearson confidence interval.

 

If you want this, PROC POWER doesn't give you the option to calculate NTOTAL for a given power. I guess the reason is that the results could be easily misinterpreted: Due to discreteness effects, the power does not increase monotonically with sample size (the corresponding graph has a sawtooth shape).


But PROC POWER lets you calculate the power for a range of sample sizes:

ntotal= 90 to 120
power= .;

In the results you see that the power of 80% is achieved with n=99 and n=100, but then drops below 80% as n further increases up to n=104 (power 76.1%). Only after another rise and fall it finally crosses the 80% mark for n>=112.

 

If you know the formula for the lower confidence limit of your choice, it's not difficult to compute the power even without PROC POWER. Here's the code using the lower limit of the one-sided Clopper-Pearson CI (replicating the results of PROC POWER):

%let alpha=0.05;
%let p0=0.81;
%let p =0.90;

data want;
do n=90 to 120;
  do k=0 to n;
    if k>0 then pL=k/(k+(n-k+1)*quantile('F',1-&alpha,2*(n-k+1),2*k)); else pL=0;
    if pL>=&p0 then leave;
  end;
  power=1-cdf('binom',k-1,&p,n);
  output;
end;
keep n power;
run;

proc print data=want noobs;
format power 5.3;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 3642 views
  • 0 likes
  • 3 in conversation