genodds.power: Power Calculations for Generalized Odds Ratios

View source: R/genodds.power.R

genodds.powerR Documentation

Power Calculations for Generalized Odds Ratios

Description

Provides power analysis for Agresti's Generalized Odds Ratios.

Usage

genodds.power(
  p0,
  p1,
  N = NULL,
  power = NULL,
  alpha = 0.05,
  ties = "split",
  w = c(0.5, 0.5),
  direction = "two.sided"
)

Arguments

p0

A numeric vector contianing the probabilities in control group.

p1

A numeric vector contianing the probabilities in treatment group.

N

A numeirc vector containing total sample sizes.

power

A numeric vector containing required total sample size.

alpha

Type 1 error.

ties

A string specifying how ties should be treated. Should be equal to "split" 0.5 for WMW Odds, or "drop" for Agresti's GenOR.

w

A numeric vector of length 2 specifying the relative weighting of sample size between treatment groups.

direction

Direction for hypothesis test. Must be one of "two.sided","upper.tail" or "lower.tail".

Details

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.

Value

If power is supplied

A numeric vector containing required sample sizes to achieve specified powers.

If N is supplied

A numeric vector containing power at specified sample sizes.

References

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.

Examples


# 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))


genodds documentation built on June 23, 2022, 9:10 a.m.