This function calculates the score confidence interval with continuity correction for a Binomial proportion. It is vectorized, allowing the evaluation of single values or vectors.

ci_p_score_cc(x, n, conf.level = 0.95)

Arguments

x

A number or a vector with the number of successes.

n

A number or a vector with the number of trials.

conf.level

Confidence level for the returned confidence interval. By default, it is 0.95.

Value

A vector with the lower and upper limits.

Details

The score confidence interval with continuity correction is an adjusted interval for the Binomial proportion \(p\).

The mathematical definitions are as follows:

Lower limit: \(\frac{2np + z^2 - 1 - z \sqrt{z^2 - 2 - \frac{1}{n} + 4p(nq + 1)}}{2n + 2z^2}\).

Upper limit: \(\frac{2np + z^2 + 1 + z \sqrt{z^2 + 2 - \frac{1}{n} + 4p(nq - 1)}}{2n + 2z^2}\).

Where \(p = x / n\) is the sample proportion, \(q = 1 - p\) its complement, and \(z\) is the critical value of the standard normal distribution.

The limits are truncated to the range \([0, 1]\).

References

Missing reference.

See also

Author

Omar David Mercado Turizo, omercado@unal.edu.co

Examples

# Example with a single value
ci_p_score_cc(x = 15, n = 50, conf.level = 0.95)
#>           [,1]
#> [1,] 0.1828562
#> [2,] 0.4478340