Estimation of required sample size as given by Cundill & Alexander (2015).

n_glm(
  mean0,
  mean1,
  dispersion0,
  dispersion1,
  alpha,
  power,
  link_fun = function(mu) NULL,
  variance_fun = function(mu, dispersion) NULL,
  dmu_deta_fun = function(mu) NULL,
  q
)

Arguments

mean0

Mean in control group

mean1

Mean in treatment group

dispersion0

Dispersion parameter in control group

dispersion1

Dispersion parameter in treatment group.

alpha

Type I error rate

power

1 - Type II error rate

link_fun

function object, the link function to create the response \(\eta\).

variance_fun

function object, function for computing the variance based on a mean and a dispersion parameter

dmu_deta_fun

function object, derivative of the original mean with respect to the link: \(d\mu / d\eta\).

q

Number between 0 and 1, the proportion of observations allocated to the control group

Value

Total sample size (numeric)

References

Cundill, B., & Alexander, N. D. E. (2015). Sample size calculations for skewed distributions. BMC Medical Research Methodology, 15(1), 1–9. https://doi.org/10.1186/s12874-015-0023-0