
Provides power analysis for Agresti's Generalized Odds Ratios.
genodds.power(
p0,
p1,
N = NULL,
power = NULL,
alpha = 0.05,
ties = "split",
w = c(0.5, 0.5),
direction = "two.sided"
)
A numeric vector contianing the probabilities in control group.
A numeric vector contianing the probabilities in treatment group.
A numeirc vector containing total sample sizes.
A numeric vector containing required total sample size.
Type 1 error.
A string specifying how ties should be treated. Should be equal to "split" 0.5 for WMW Odds, or "drop" for Agresti's GenOR.
A numeric vector of length 2 specifying the relative weighting of sample size between treatment groups.
Direction for hypothesis test.
Must be one of "two.sided"
,"upper.tail"
or "lower.tail"
.
power
is suppliedA numeric vector containing required sample sizes to achieve specified powers.
N
is suppliedA numeric vector containing power at specified sample sizes.
See genodds
for explanation of generalized odds ratios.
N
provides the total sample size.
Sample size per group can be calculated by N*w/sum(w)
.
When power
is supplied, if no sufficient sample size is
found then this function will return Inf
.
O'Brien, R. G., & Castelloe, J. (2006, March). Exploiting the link between the Wilcoxon-Mann-Whitney test and a simple odds statistic. In Thirty-first Annual SAS Users Group International Conference.
# NOT RUN {
# Provide theoretical distributions of outcomes for each group
# Distributions taken from Lees et. al. (2010). See ?alteplase for a citation.
p0 <- c(0.224,0.191,0.082,0.133,0.136,0.043,0.191)
p1 <- c(0.109,0.199,0.109,0.120,0.194,0.070,0.200)
# Calculate sample size required to achieve 80% and 90%
# power for these distributions
genodds.power(p0,p1,power=c(0.8,0.9))
# genodds.power suggests a total sample size of 619 for 80% power.
# Round up to 620 for even sample size per group
# Confirm these sample sizes lead to 80% and 90% power
genodds.power(p0,p1,N=c(620,830))
# }
Run the code above in your browser using DataLab