power_prop_test function

Power Calculations for Two-Sample Test for Proportions with unequal sample size

Power Calculations for Two-Sample Test for Proportions with unequal sample size

Compute power of test, or determine parameters to obtain target power for equal and unequal sample sizes.

power_prop_test( n = NULL, p1 = NULL, p2 = NULL, sig.level = 0.05, power = NULL, ratio = 1, alternative = c("two.sided", "one.sided"), tol = .Machine$double.eps^0.25 )

Arguments

  • n: Number of observations (in group 1)
  • p1: Probability in one group
  • p2: Probability in other group
  • sig.level: Significance level (Type I error probability)
  • power: Power of test (1 minus Type II error probability)
  • ratio: The ratio n2/n1 between the larger group and the smaller group. Should be a value equal to or greater than 1 since n2 is the larger group. Defaults to 1 (equal group sizes)
  • alternative: String. Can be one- or two-sided test. Can be abbreviated.
  • tol: Numerical tolerance used in root finding, the default providing (at least) four significant digits

Returns

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

Details

Exactly one of the parameters n, delta, power, sd, sig.level, ratio sd.ratio

must be passed as NULL, and that parameter is determined from the others. Notice that the last two have non-NULL defaults so NULL must be explicitly passed if you want to compute them.

Note

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.

Examples

power_prop_test(n=NULL, p1=.65, p2=.85, power=.8, ratio=2)

See Also

power.prop.test, power_t_test, power.t.test

Author(s)

Claus Ekstrom claus@rprimer.dk

  • Maintainer: Claus Thorn Ekstrøm
  • License: GPL-2
  • Last published: 2023-08-20