Package 'fcci'

Title: Feldman-Cousins Confidence Intervals
Description: Provides support for building Feldman-Cousins confidence intervals [G. J. Feldman and R. D. Cousins (1998) <doi:10.1103/PhysRevD.57.3873>].
Authors: Valerio Gherardi [aut, cre]
Maintainer: Valerio Gherardi <[email protected]>
License: GPL (>= 3)
Version: 1.0.1
Built: 2024-11-23 03:48:13 UTC
Source: https://github.com/vgherard/fcci

Help Index


Binomial proportion confidence intervals

Description

Build confidence intervals for binomial proportions using the Feldman-Cousins construction (Feldman and Cousins, 1998).

Usage

confint_binom(n, N, cl = 0.95, acc = 0.001)

Arguments

n

number of successes. Numeric vector of length one.

N

number of trials. Numeric vector of length one.

cl

confidence level for the returned confidence interval. A number between zero and one.

acc

required accuracy in the confidence interval endpoints. A positive number.

Details

More details on the Feldman-Cousins construction can be found in the documentation page of confint_pois.

Value

a numeric vector of length two, containing the confidence interval endpoints.

References

Feldman, Gary J. and Cousins, Robert D. "Unified approach to the classical statistical analysis of small signals" Phys. Rev. D 57, issue 7 (1998): 3873-3889.

See Also

confint_pois

Examples

confint_binom(50, 100, cl = 0.95, acc = 1e-3)

Poisson rate confidence intervals

Description

Build confidence intervals for the rate of a Poisson random variable using the Feldman-Cousins construction (Feldman and Cousins, 1998).

Usage

confint_pois(
  n,
  b = 0,
  cl = 0.95,
  acc = 0.001 * (max(n - b, 0) + 1),
  lambda_min = NULL,
  lambda_max = NULL
)

Arguments

n

number of events. Numeric vector of length one.

b

expected number of background events. Numeric vector of length one or three (see Details).

cl

confidence level for the returned confidence interval. A number between zero and one.

acc

required accuracy in the confidence interval endpoints. A positive number.

lambda_min, lambda_max

window of Poisson rate values for whom the Neyman belt construction is performed. Numeric vectors of length one or NULL (see Details). For advanced users only, use the default value (NULL) if unsure.

Details

The Feldman-Cousins confidence intervals construction (Feldman and Cousins, 1998) provides a unified treatment for the estimation of Poisson rates, which produces consistent results for both the common case, where the number of observed events n is greater than the number of background events b, and the boundary cases, when n is equal or even less than b. In these last cases, a naive treatment can lead to either overcovering (that is, unnecessarily large confidence intervals; this is the case for, e.g., the intervals returned from stats::poisson.test for zero events and no background) or, even worse, undercovering and/or non-sensical confidence intervals (relevant examples can be found in (Feldman and Cousins, 1998)).

In order to find confidence intervals, the standard Neyman construction is performed over a grid of values for the estimated rate. The search interval can be controlled through the parameters lambda_min and lambda_max; if these are left as default (NULL), they are estimated automatically based on a rough estimate, which should be adequate in a large majority of cases.

The argument b controls the expected number of background events, which would differ from zero if some of the event counts are expected to correspond to spurious events. In other words, the number of total counts n is assumed to follow a Poisson distribution with rate lambda + b, with b known and lambda unknown and to be estimated.

The original reference discusses a minor correction to confidence intervals, which ensures that the produced upper limits are decreasing functions of b. This is computationally intensive and not necessary for the correctness of Feldman-Cousins confidence intervals, but may facilitate interpretation for e.g. sensitivity analyses. The correction can be implemented by providing a length three numeric to the b argument, such that b[[1]] is the expected background rate as before, while b[[2]] and b[[3]] represent a maximum value for b and a grid step. The construction is repeated over the whole grid of b values and the actual upper limit is chosen as the greatest upper limit encountered in the sequence of intervals so constructed.

Value

a numeric vector of length two, containing the confidence interval endpoints.

References

Feldman, Gary J. and Cousins, Robert D. "Unified approach to the classical statistical analysis of small signals" Phys. Rev. D 57, issue 7 (1998): 3873-3889.

Examples

confint_pois(n = 10, cl = 0.68)
confint_pois(n = 10, b = 5, cl = 0.68)

# Compare:
confint_pois(n = 0, cl = 0.95)
# with:
poisson.test(x = 0, conf.level = 0.95)$conf.int