Title:  FeldmanCousins Confidence Intervals 

Description:  Provides support for building FeldmanCousins 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:  20241024 03:43:30 UTC 
Source:  https://github.com/vgherard/fcci 
Build confidence intervals for binomial proportions using the FeldmanCousins construction (Feldman and Cousins, 1998).
confint_binom(n, N, cl = 0.95, acc = 0.001)
confint_binom(n, N, cl = 0.95, acc = 0.001)
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. 
More details on the FeldmanCousins construction can be found in the documentation page of confint_pois.
a numeric vector of length two, containing the confidence interval endpoints.
Feldman, Gary J. and Cousins, Robert D. "Unified approach to the classical statistical analysis of small signals" Phys. Rev. D 57, issue 7 (1998): 38733889.
confint_binom(50, 100, cl = 0.95, acc = 1e3)
confint_binom(50, 100, cl = 0.95, acc = 1e3)
Build confidence intervals for the rate of a Poisson random variable using the FeldmanCousins 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 )
confint_pois( n, b = 0, cl = 0.95, acc = 0.001 * (max(n  b, 0) + 1), lambda_min = NULL, lambda_max = NULL )
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 
The FeldmanCousins 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 nonsensical 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
FeldmanCousins 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.
a numeric vector of length two, containing the confidence interval endpoints.
Feldman, Gary J. and Cousins, Robert D. "Unified approach to the classical statistical analysis of small signals" Phys. Rev. D 57, issue 7 (1998): 38733889.
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
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