Learn R Programming

MESS (version 0.5.12)

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

Description

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

Usage

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
)

Value

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

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

Author

Claus Ekstrom claus@rprimer.dk

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.

See Also

Examples

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

Run the code above in your browser using DataLab