I want to compute the sample size to compare two groups for a binary outcome where we expect rare events. I will do an example with R. Assume the following expected probabilities of observing an event in both groups.
p1 <- 0.0001 ## 1 event out of 10000 subjects
p2 <- 0.05 ## 500 events out of 10000 subjects
Sample size calculation yields
power.prop.test(p1=p1, p2=p2, power=0.8, sig.level=0.05) ## n = 153 by group
Now I just try to compute the power with simulations using an exact test given the sample size.
set.seed(123)
R <- 10000 ## number of repetitions
n <- 158 ## I slightly increase the sample size because of the exact test
pval <- NULL
n.events1 <- n.events2 <- NULL
for (i in 1:R){
x <- sum(rbinom(n, 1, p1))
y <- sum(rbinom(n, 1, p2))
ct <- matrix(c(n-x, x, n-y, y), nrow = 2)
pval[i] <- fisher.test(ct)$p.val
n.events1[i] <- x
n.events2[i] <- y
}
mean(pval<0.05) ## = 0.799; fine we have 80% power
table(n.events1) ## 9833 times we have 0 event, 167 times 1 event only
p1*n ## = 0.0158 = expected number of events observed in group 1. So much less than 1...
mean(n.events1) ## = 0.0167 fine quite close to p1*n
table(n.events2) ## not that important for group 2
p2*n ## = 7.9 = expected number of events in group 2
mean(n.events2) ## = 7.86 fine
So both methods approximately match.
My issue is that if I decide to start a study with 158 subjects by group, it is highly likely that in group 1, I will not observe any event. I mean, out of 10000 repetitions, only 167 times we got 1 event. I am wondering if in the end it would be possible to analyze these data after completion. Also even if I'm lucky enough to observe 1 event in group 1.
Am I missing something? Is the approach a complete nonsense in this setting? Is the Fisher test not applicable? Or something else?