Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

power_NegativeBinomial

Power Calculation for Comparing Two Negative Binomial Rates


Description

Compute sample size or power for comparing two negative binomial rates.

Usage

power_NegativeBinomial(n1 = NULL, n2 = NULL, mu1 = NULL, mu2 = NULL, 
sig.level = 0.05, power = NULL, duration = 1, theta = NULL,
equal.sample = TRUE, alternative = c("two.sided", "one.sided"),
approach = 3)

Arguments

n1

sample size in group 1, or sample size in each group if equal.sample = TRUE

n2

sample size in group 2

mu1

expected rate of events per time unit for group 1

mu2

expected rate of events per time unit for group 2

sig.level

significance level (Type I error probability)

power

power of test (1 minus Type II error probability)

duration

(average) treatment duration

theta

theta parameter of negative binomial distribution; see rnegbin

equal.sample

equal sample sizes for two groups, see details

alternative

one- or two-sided test

approach

1, 2, or 3, see details

Details

Exactly one of the parameters n1, n2, and power must be passed as NULL, and that parameter is determined from the others.

If equal.sample = TRUE is used, N in output will denote the number in each group.

The computations are based on the formulas given in Zhu and Lakkis (2014). For approach 1, the events rates under null hypothesis are set as mu1 for both group 1 and group 2. For approach 2, the events rates under null hypothesis are set as mu1 and mu2 for group 1 and group 2, respectively. For approach 3, the events rates under null hypothesis are set as the maximum likelihood estimation of the overall events rate for both group 1 and group 2.

Value

Object of class "power.htest", a list of the arguments (including the computed one) augmented with note and method elements.

References

H. Zhu and H. Lakkis (2014). Sample size calculation for comparing two negative binomial rates. Statistics in Medicine, 33:376-387.

Examples

# calculate power, equal sizes
power_NegativeBinomial(n1 = 20, mu1 = 1, mu2 = 2, theta = 0.8)
# calculate power, unequal sizes
power_NegativeBinomial(n1 = 80, n2 = 40, mu1 = 1, mu2 = 2, theta = 0.8)
# calculate n
power_NegativeBinomial(mu1 = 1, mu2 = 2, theta = 0.8, power = 0.8)

PASSED

Calculate Power and Sample Size for Two Sample Mean Tests

v1.1-0
GPL (>= 2)
Authors
Jinpu Li [aut, cre], Ryan Knigge [aut], Kaiyi Chen [aut], Emily Leary [aut]
Initial release
2021-05-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.