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

View source: R/powerProp1Test.R

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

1 2 3 4 |

`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. |

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.

Object of class `"power.htest"`

, a list of the arguments
(including the computed one) augmented with `method`

and
`note`

elements.

The documentation was adapted from `power.prop.test`

.

Matthias Kohl [email protected]

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

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")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.