power.prop1.test: Power Calculations for One-Sample Test for Proportions

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/powerProp1Test.R

Description

Compute the power of the one-sample test for proportions, or determine parameters to obtain a target power.

Usage

1
2
3
4
power.prop1.test(n = NULL, p1 = NULL, p0 = 0.5, sig.level = 0.05, 
                             power = NULL, 
                             alternative = c("two.sided", "less", "greater"),
                             cont.corr = TRUE, tol = .Machine$double.eps^0.25)

Arguments

n

number of observations (per group)

p1

expected probability

p0

probability under the null hypothesis

sig.level

significance level (Type I error probability)

power

power of test (1 minus Type II error probability)

alternative

one- or two-sided test. Can be abbreviated.

cont.corr

use continuity correction

tol

numerical tolerance used in root finding, the default providing (at least) four significant digits.

Details

Exactly one of the parameters n, p1, power, and sig.level must be passed as NULL, and that parameter is determined from the others. Notice that sig.level has a non-NULL default so NULL must be explicitly passed if you want it computed.

The computation is based on the asymptotic formulas provided in Section 2.5.1 of Fleiss et al. (2003). If cont.corr = TRUE a continuity correction is applied, which may lead to better approximations of the finite-sample values.

Value

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

Note

The documentation was adapted from power.prop.test.

Author(s)

Matthias Kohl [email protected]

References

J.L. Fleiss, B. Levin and M.C. Paik (2003). Statistical Methods for Rates and Proportions. Wiley Series in Probability and Statistics.

See Also

power.prop.test, prop.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
power.prop1.test(p1 = 0.4, power = 0.8)
power.prop1.test(p1 = 0.4, power = 0.8, cont.corr = FALSE)
power.prop1.test(p1 = 0.6, power = 0.8)
power.prop1.test(n = 204, power = 0.8)
power.prop1.test(n = 204, p1 = 0.4, power = 0.8, sig.level = NULL)
power.prop1.test(n = 194, p1 = 0.4, power = 0.8, sig.level = NULL, 
                 cont.corr = FALSE)

power.prop1.test(p1 = 0.1, p0 = 0.3, power = 0.8, alternative = "less")
power.prop1.test(p1 = 0.1, p0 = 0.3, power = 0.8, alternative = "less", 
                 cont.corr = FALSE)
power.prop1.test(n = 31, p0 = 0.3, power = 0.8, alternative = "less")
power.prop1.test(n = 31, p1 = 0.1, p0 = 0.3, power = 0.8, sig.level = NULL, 
                 alternative = "less")


power.prop1.test(p1 = 0.5, p0 = 0.3, power = 0.8, alternative = "greater")
power.prop1.test(p1 = 0.5, p0 = 0.3, power = 0.8, alternative = "greater", 
                 cont.corr = FALSE)
power.prop1.test(n = 40, p0 = 0.3, power = 0.8, alternative = "greater")
power.prop1.test(n = 40, p1 = 0.5, p0 = 0.3, power = 0.8, sig.level = NULL, 
                 alternative = "greater")

stamats/MKpower documentation built on Jan. 17, 2020, 2:03 p.m.