prop.2samp: Power calculation for two-sample proportion test

prop.2sampR Documentation

Power calculation for two-sample proportion test

Description

Performs power and sample size calculations for two-sample tests of proportions using normal approximation to the binomial. Can solve for power, n1, n.ratio or alpha.

Usage

prop.2samp(
  n1 = NULL,
  n.ratio = 1,
  p1 = NULL,
  p2 = NULL,
  margin = 0,
  alpha = 0.05,
  power = NULL,
  sides = 2,
  v = FALSE
)

Arguments

n1

The sample size for group 1.

n.ratio

The ratio n2/n1 between the sample sizes of two groups; defaults to 1 (equal group sizes).

p1

The proportion in group 1.

p2

The proportion in group 2.

margin

The margin of noninferiority or superiority; defaults to 0.

alpha

The significance level (type 1 error rate); defaults to 0.05.

power

The specified level of power.

sides

Either 1 or 2 (default) to specify a one- or two- sided hypothesis test.

v

Either TRUE for verbose output or FALSE (default) to output computed argument only.

Details

For a noninferiority or superiority by a margin test, a one-sided test should be used. See Crespi (2025) for more guidance. For an equivalence test for two proportions, see the prop.test.equiv.

Value

A list of the arguments (including the computed one).

Examples

prop.2samp(n1 = NULL, p1 = 0.6, p2 = 0.8, alpha = 0.025, power = 0.9, sides = 1)
prop.2samp(n1 = NULL, p1 = 0.25, p2 = 0.25, margin = 0.1, alpha = 0.025, power = 0.8, sides = 1)

powertools documentation built on April 4, 2025, 5:02 a.m.