Calculates values of the acceptability function for the Poisson distribution (see Blaker (2000)) in a sequence of points (for, e.g., plotting purposes). The acceptability function may optionally be “unimodalized”, i.e. replaced with the smallest greater or equal unimodal function.
number of events.
vector (length 1 allowed) of hypothesized Poisson parameters. In case of more than one point, an increasing sequence required.
numerical tolerance (relevant only for
additional arguments to be passed to
Single values of the “unimodalized” acceptability function
type = "unimod") are computed by an iterative
numerical algorithm implemented in internal function
The function cited is called just once in each of the intervals
where the acceptability function is continuous
(namely in the leftmost one of those points of
that fall into the interval when dealing with points
x, and the rightmost one when above
x). The rest is done by function
This is considerably faster than calling
for every point of
Note that applying
cummax directly to
a vector of unmodified acceptability values
is even faster and provides a unimodal output;
it may, nevertheless, lack accuracy.
Vector of acceptability values (with or without unimodalization)
in points of
Inspired by M.P. Fay (2010), mentioning “unavoidable inconsistencies” between tests with non-unimodal acceptability functions and confidence intervals derived from them. When the acceptability functions are unimodalized and the test modified accordingly (i.e. p-values slightly increased in some cases), a perfectly matching test-CI pair is obtained.
Jan Klaschka email@example.com
Blaker, H. (2000) Confidence curves and improved exact confidence
intervals for discrete distributions.
Canadian Journal of Statistics 28: 783-798.
(Corrigenda: Canadian Journal of Statistics 29: 681.)
Fay, M.P. (2010). Two-sided Exact Tests and Matching Confidence Intervals for Discrete Data. R Journal 2(1): 53-58.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
p <- seq(0,10,length=1001) acc <- poisson.blaker.acc(3,p) acc1 <- poisson.blaker.acc(3,p,type="unimod") plot(p,acc,type="l") lines(p,acc1,col="red") legend(x=7,y=.8,c("orig","unimod"),col=c("black","red"),lwd=1) ## The two lines -- the unimodalized and original acceptabilities -- ## look almost the same but some small differences are slightly ## visible. ## They can be seen better this way: plot(p,acc1-acc,type="l") ## Focussing on one of them: p <- seq(5.05,5.6,length=1001) acc <- poisson.blaker.acc(3,p) acc1 <- poisson.blaker.acc(3,p,type="unimod") plot(p,acc,type="l",ylim=c(.391,.396)) lines(p,acc1,col="red") legend(x=5.4,y=.395,c("orig","unimod"),col=c("black","red"),lwd=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.