# example data for a randomized controlled trial
# subject group success
#
# 1 1 1
# 2 0 1
# 3 1 0
# 4 0 1
# 5 1 1
# ... ... ...
# 100 0 0
# prob1 = mean(success | group = 1)
# prob2 = mean(success | group = 0)
# post-hoc exact power
power.exact.fisher(prob1 = 0.60, prob2 = 0.40, n2 = 50)
# we may have 2 x 2 joint probs such as
# -------------------------------------
# | group (1) | group (0) |
# -------------------------------------
# success (1) | 0.24 | 0.36 |
# -------------------------------------
# success (0) | 0.16 | 0.24 |
# -------------------------------------
# convert joint probs to marginal probs
marginal.probs.2x2(prob11 = 0.24, prob10 = 0.36,
prob01 = 0.16, prob00 = 0.24)
Run the code above in your browser using DataLab