View source: R/power_Poisson.R
power_Poisson | R Documentation |
Compute the power for a test of two sample means with Poisson distributions, or determine parameters to obtain a target power.
power_Poisson(n1 = NULL, n2 = NULL, power = NULL, sig.level = 0.05,
lambda1 = NULL, lambda2 = NULL, t1 = 1, t2 = 1, RR0 = 1,
equal.sample = TRUE, alternative = c("two.sided", "one.sided"))
n1 |
sample size in group 1, or sample size in each group if |
n2 |
sample size in group 2 |
power |
power of test (1 minus Type II error probability) |
sig.level |
significance level (Type I error probability) |
lambda1 |
Poisson rate for group 1 |
lambda2 |
Poisson rate for group 2 |
t1 |
observed time period for group 1 |
t2 |
observed time period for group 2 |
RR0 |
the ratio of lambda2 and lambda1 under null hypothesis |
equal.sample |
equal sample sizes for two groups, see details |
alternative |
one- or two-sided test |
Exactly one of the parameters n1
, n2
, lambda1
, lambda2
, power
, and sig.level
must be passed as NULL, and that parameter is determined from the others.
Notice that sig.level
has non-NULL defaults, so NULL must be explicitly passed if you want to compute them.
If equal.sample = TRUE
is used, n2
would be ignored and N in output denotes the number in each group.
Object of class "power.htest", a list of the arguments (including the computed one) augmented with method element.
'uniroot' is used to solve power equation for unknowns, so you may see errors from it, notably about inability to bracket the root when invalid arguments are given.
Gu et al. (2008). Testing the ratio of two poisson rates. Biometrical Journal: Journal of Mathematical Methods in Biosciences. 50:283-298.
# Calculate power, equal sizes
power_Poisson(lambda1 = 0.0005, lambda2 = 0.003, n1 = 2000, t1 = 2, t2 = 2)
# Calculate sample size, equal sizes
power_Poisson(lambda1 = 0.0005, lambda2 = 0.003, power = 0.8, t1 = 2, t2 = 2)
# Calculate sample size for group 2, unequal sizes
power_Poisson(n1 = 2000, lambda1 = 0.0005, lambda2 = 0.003, power = 0.8,
t1 = 2, t2 = 2, equal.sample = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.