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

Closed calculation of the power to reject a hypothesis using confidence intervals for a single binomial proportion, for specified sample size n, conf.level and an assumed absolute difference to the threshold parameter under the null hypothesis.

1 2 | ```
binPower(n, delta, p.hyp, conf.level = 0.95,
alternative = "two.sided", method = "CP")
``` |

`n` |
number of trials n in the binomial experiment, specify as a single integer |

`delta` |
assumed absolute difference of the true proportion to the threshold proportion under the null hypothesis |

`p.hyp` |
threshold proportion under the null hypothesis |

`conf.level` |
nominal confidence level of the interval |

`alternative` |
character string, defining the alternative hypothesis, either |

`method` |
Character string, specifying the confidence interval method (see |

The power of a confidence interval here is defined as the probability that a confidence interval or limit excludes the threshold parameter (`p.hyp`) of the null hypothesis.
E.g., the null hypothesis H0: p>= 0.005 can be rejected, if an upper confidence limit for p does not contain p.hyp=0.005.
In case that a delta of 0.002 shall be detectable, this function calculates the probability, that an interval of a given method will
exclude p.hyp=0.005 if the true proportion = 0.003.
Due to discreteness, the power does not increase monotone for increasing sample size (number of trials or indivoiduals under observation) n,
but exhibits local maxima and minima, depending on n, conf.level and p.hyp.
The power can be identical for different methods, depending on the particular combination of n, p.hyp, conf.level.
Note, that coverage probability and power are not necessarily symmetric for upper and lower bound of binomial CI,
especially for Wald, Wilson Score and Agresti-Coull CI.

A list containing

`power` |
the power which is achieved for the specified parameters and method |

Frank Schaarschmidt

`binDesign`

for iteration of a sample size n for which a specified power is reached

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
# What is the probability to reject the null hypothesis
# H0: p >= 0.02 in order to show that the alternative
# hypothesis HA: p < 0.02 is very likely in the first
# example of if 200 seeds are taken from a seed lot and
# are checked for the proportion of defectives.
# Assume a true proportion under the alternative:
# p = 0.01, i.e. a absolute difference delta = 0.01
# to the threshold proportion p.hyp=0.02.
# The null hypothesis can be rejected if the threshold
# p.hyp=0.02 is excluded by an 95 percent upper bound of the
# Clopper-Pearson CI. What is the probability of this event?
binPower(n=200, delta=0.01, p.hyp=0.02,
alternative="less", method="CP")
# Assuming a lower true proportion (if one is satisfied
# also with the situation that we can only reject H0
# in case that the seed lot has a very high purity, e.g.
# only a proportion of 0.001 defectives )
binPower(n=200, delta=0.019, p.hyp=0.02,
alternative="less", method="CP")
# Or use a higher sample size:
binPower(n=600, delta=0.01, p.hyp=0.02,
alternative="less", method="CP")
``` |

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.