Build confidence intervals for the rate of a Poisson random variable using the Feldman-Cousins construction (Feldman and Cousins, 1998).
confint_pois( n, b = 0, cl = 0.95, acc = 0.001 * (max(n - b, 0) + 1), lambda_min = NULL, lambda_max = NULL )
number of events. Numeric vector of length one.
expected number of background events. Numeric vector of length one or three (see Details).
confidence level for the returned confidence interval. A number between zero and one.
required accuracy in the confidence interval endpoints. A positive number.
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.
a numeric vector of length two, containing the confidence interval endpoints.
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
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_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.
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
The original reference discusses a minor correction to confidence intervals,
which ensures that the produced upper limits are decreasing functions of
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[] is the expected background rate as
b[] represent a maximum value
b and a grid step. The construction is repeated over the whole
b values and the actual upper limit is chosen as the
greatest upper limit encountered in the sequence of intervals so constructed.
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.
confint_pois(n = 10, cl = 0.68) #>  6.781298 13.804798 #> attr(,"cl") #>  0.68 confint_pois(n = 10, b = 5, cl = 0.68) #>  1.899 8.805 #> attr(,"cl") #>  0.68 # Compare: confint_pois(n = 0, cl = 0.95) #>  0.0000 3.0925 #> attr(,"cl") #>  0.95 # with: poisson.test(x = 0, conf.level = 0.95)$conf.int #>  0.000000 3.688879 #> attr(,"conf.level") #>  0.95