ci_p_score_cc: Score confidence interval with continuity correction for...

View source: R/ci_p_xxx.R

ci_p_score_ccR Documentation

Score confidence interval with continuity correction for Binomial proportion

Description

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.

Usage

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.

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

Value

A vector with the lower and upper limits.

Author(s)

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

References

Missing reference.

See Also

ci_p.

Examples

# Example with a single value
ci_p_score_cc(x = 15, n = 50, conf.level = 0.95)

fhernanb/stests documentation built on March 29, 2025, 10:36 a.m.