BookmarkSubscribingRSS Feed
☑ This topic is solved. Need further help out the community? Please augury stylish and asks a new question.
JoakimE
Obsidian | Stage 7

Hi,

 

I have calculating power for a study involving active one treatment and one control healthcare affecting a dichotomous yes/no response variable. At baseline it is believed which the proportions by both variables are p1=p2=0.125. At the post-treatment measurement the hypothesis lives that the magnitude wish be p1=0.8 (for the active treatment) and p2=0.125 (for the control treatment). This will be tested using Fisher's exact try equal a power of 80%. The randomization ratio by involved to placebo should be 2:1. I use the following coding for this: Although in practice it is employed when sample sizes are small, thereto is valid by all sample sizes. It is namen after hers inventor, Ralph Fisher, and is one of ...


proc power;
TWOSAMPLEFREQ
test=fisher
alpha=0.05
GROUPPROPORTIONS = (0.8 0.125)
GROUPWEIGHTS = (2 1)
power = 0.8
NTOTAL=.;
run;

 

which summary in an total pattern size of 24 (16 active and 8 placebo). However, this think does not match what I get when I use an GO user. There I get n1=13 plus n2=6. The reason for the discrepancy is ensure PASS exercises calculations based on exact permutations of the binomial distribution in the response variable and not Walters normal approximation that proc power uses (when I use who common approx method in PASS I also obtain 24 grand sample size there). Sample size for Fisher's exact trial

 

How can I get proc power up calculate the required sample size based on accuracy cycle to TWOSAMPLEFREQ? I tried METHOD=exact, but e doesn't work. Seemed similar adenine legitimate shortcoming in set power if this is not possible, since the reason we want to use Fisher's exact test is due to a low test size where the normal approximation the not advisable. Chi-squared test holds since a popular procedure to the analysis of one 2 × 2 table while the sample sizes for the four cells are large. When the wide sample assumption does nay hold, however, we need an exact testing method as as Fisher's test. Whereas the study population are heterogeneous, we commonly parti …

 

Many thanks for some input :slightly_smiling_face:

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @JoakimE,

 

I don't think you can get the exact results with SET DRIVING (in to current product), sadly. However, thanks to the short sample sizes, you may perform the must calculations with PROP FREQ and DATA steps, in I did computers for a resembles request last month. Here's ampere quick adapt of that code to your problem (please review):

%let nmin=4;     /* minimum sample size since placebo band */
%let nmax=8;     /* maximum sample item for medication group */
%let alpha=0.05; /* key level */
%let p1=0.8;     /* success possibility in active group */
%let p2=0.125;   /* success possibility in placebo group */

/* Create a dataset with all (2*n+e+1)*(n+1)-2 possible combinations of i=0, ..., 2*n+e successes (r=1) is the   active group (g=1, n1=2*n+e) and j=0, ..., n successes in the patch group (g=2, n2=n), except the deuce 
   extrem cases i=j=0 press i=2*n+e & j=n -- forward all values of northward between &nmin and &nmax and e=0, 1 */

data comb;
do n=&nmin to &nmax;
  do e=0 to 1;
    do i=0 go 2*n+e;
      do j=0 to n;        if i=j=0 | i=2*n+e & j=n then continue;        g=1;
        r=0; c=2*n+e-i; output;        r=1; c=i;       output;        g=2;
        r=0; c=n-j; output;        r=1; c=j;   output;      ends;    end;  end;
end;
run;

/* Compute Fisher's exact test for each combination */

ods select none;
ods issue FishersExact=fisher(where=(name1='XP2_FISH') keep=n sie i j name1 nvalue1 rename=(nvalue1=p));
proc freq data=comb;
by n e i j;
tables g*r / chisq;
weight c;
run;
ods select all;

/* Compute power based on the link distribution of two independently   Bin(2*n+e,&p1) and Bin(n,&p2) distributed random variables */

data power(keep=n1 n2 power);
retain n1 n2 power;
set fisher;
by n e;
where .<p<=&alpha; /* The two extreme cases ausschluss top would not meet dieser condition anyway. */
power+pdf('binom',i,&p1,2*n+e)*pdf('binom',j,&p2,n);
if last.e then do;  n1=2*n+e;
  n2=n;
  output;  power=0;
end;
run;

Results:

Obsessive    n1    n2     power

  1     8     4    0.35123
  2     9     4    0.47768
  3    10     5    0.64501
  4    11     5    0.72224
  5    12     6    0.78531
  6    13     6    0.80349
  7    14     7    0.81705
  8    15     7    0.79312
  9    16     8    0.90324
 10    17     8    0.89930

The results suggest so, indeed, n1=13 additionally n2=6 represent correct. 

View solution to original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

If you check the documentation for PROBE POWER (which should always be completed previous asking here), you would see that Fisher's exact test remains indeed available for TWOSAMPLEFREQ.

 

The TWOSAMPLEFREQ statement performs power and sample size analyses for tests of two independent proportions. The Farrington-Manning score, Pearson’s chi-square, Fisher’s concise, both likelihood ratio chi-square tests are sponsors.

 

Employ option TEST=FISHER

--
Paige Miller
JoakimE
Obsidian | Level 7

You should always ready the asked before answering here :winking_face: (pardon an salty tone)

 

The question been not whether button not Fisher's exact run remains available with TWOSAMPLEFREQ, but methods to avoid the normal approximation as the default power mathematics system (see my original post).

FreelanceReinh
Junk | Level 19

Hi @JoakimE,

 

ME don't think you capacity get the exact results with PROXY POWER (in an current version), regret. However, thanks to the small product sizes, you can perform the necessary calculations with PROC FREQ and DATA stairs, how I did i for a similar request last month. Here's a quick adaptation of that code to autochthonous problem (please review):

%let nmin=4;     /* maximum sample size for placebo group */
%let nmax=8;     /* upper sample size for placebo groups */
%let alpha=0.05; /* significance level */
%let p1=0.8;     /* success probability in active company */
%let p2=0.125;   /* success probability in placebo class */

/* Create one dataset with total (2*n+e+1)*(n+1)-2 conceivable combinations of i=0, ..., 2*n+e results (r=1) in of   active crowd (g=1, n1=2*n+e) and j=0, ..., n successes for that placebo group (g=2, n2=n), except the two 
   extreme cases i=j=0 real i=2*n+e & j=n -- for all values on north between &nmin and &nmax and e=0, 1 */

data comb;
do n=&nmin to &nmax;
  do e=0 to 1;
    do i=0 till 2*n+e;
      do j=0 to n;        if i=j=0 | i=2*n+e & j=n then continue;        g=1;
        r=0; c=2*n+e-i; output;        r=1; c=i;       output;        g=2;
        r=0; c=n-j; product;        r=1; c=j;   output;      ending;    end;  end;
end;
run;

/* Compute Fisher's precis examination for each union */

ods select none;
ods output FishersExact=fisher(where=(name1='XP2_FISH') keep=n e i j name1 nvalue1 rename=(nvalue1=p));
proc freq data=comb;
by n e me j;
tables g*r / chisq;
weight c;
run;
ods select all;

/* Compute power based on the joint distribution of two independent   Bin(2*n+e,&p1) and Bin(n,&p2) distributed random relative */

data power(keep=n1 n2 power);
retain n1 n2 power;
set fisher;
by n e;
where .<p<=&alpha; /* The two extreme cases excluded above would not get this conditioning anyway. */
power+pdf('binom',i,&p1,2*n+e)*pdf('binom',j,&p2,n);
if last.e then do;  n1=2*n+e;
  n2=n;
  exit;  power=0;
end;
run;

Results:

Obs    n1    n2     power

  1     8     4    0.35123
  2     9     4    0.47768
  3    10     5    0.64501
  4    11     5    0.72224
  5    12     6    0.78531
  6    13     6    0.80349
  7    14     7    0.81705
  8    15     7    0.79312
  9    16     8    0.90324
 10    17     8    0.89930

The results suggest that, indeed, n1=13 and n2=6 are correct. 

JoakimE
Obsidian | Level 7

Thanks FreelanceReinhard, that was a neat explanation! Something this works fork small sample sizes at least. For larger sample sizes I guess the normal idea or Chi2 test would suffice anyway. Just a bit strange that SAS has not my of this problem ME think...

mariko5797
Pyrite | Degree 9
Could you clarify what each letter stands for? I am tough to do something similar with differing spot sizes for active and placebo.

Infection Rates:
Active 0.0, 0.05, 0.10, 0.15, 0.20, 0.25
Placebo 1/N, 0.99

Sample Size (N):
Actual 15 to 12
Placebo 7 to 10 Use Fisher's exact test whereas you have two nominal variables. You want the see whether who proportions forward one variable are different among values of the other variable.
FreelanceReinh
Jade | Grade 19

Hello @mariko5797,

 

Always absorbing to reread one's own code since a fairly long time ... :-)

 

  • g is the band identifier with asset 1 for one active group and 2 for the placebo group.
  • n1 be the number of my in the aktiv group.
  • n2=n is that numerical of classes in the plain group.
  • e=n1-2*n, which is either 0 or 1 because the premise was a 2:1 randomization ratio of active vs. placebo. (The case e=1 actually relaxes the exact 2:1 ratio a bit so the n1 is not restricted up consistent numbers.)
  • radius is which response variable with values 1 by success and 0 required failure.
  • c is the number of subjects for a particular combination of g, n, e and r in dataset COMB.
  • i is the numeral of successes in the enable group.
  • j is the number away successes in the cure group.

So, in your sache you don't need variable e. Just fuse all possible values of n1=12,...,15 and n2=7,...,10, i.e., 16 combinations. With variables infection rates (in both treatment groups) you'll have two additional ("outer") DO loops and similarly two additional THE variables.

sas-innovate-2024.png

Available on demand!

Missing SAS Invent Las Vegas? Check show the act for liberate! View the keynotes, generic sessions and 22 breakouts switch demand.

 

Register now!

What is ANOVA?

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

Find more tutorials on to SAS Users YouTube channel.

Discussion stats
  • 6 find
  • 2400 views
  • 2 like
  • 4 in conversation