Description Usage Arguments Details Value Note Author(s) References Examples
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.
1 2 | poisson.blaker.acc(x, p, type = c("orig", "unimod"),
acc.tol = 1e-10, ...)
|
x |
number of events. |
p |
vector (length 1 allowed) of hypothesized Poisson parameters. In case of more than one point, an increasing sequence required. |
type |
for |
acc.tol |
numerical tolerance (relevant only for |
... |
additional arguments to be passed to
|
Single values of the “unimodalized” acceptability function
(for type = "unimod") are computed by an iterative
numerical algorithm implemented in internal function
poisson.blaker.acc.single.p.
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 p
that fall into the interval when dealing with points
below x, and the rightmost one when above
x). The rest is done by function
cummax.
This is considerably faster than calling
poisson.blaker.acc.single.p
for every point of p.
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 p.
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 klaschka@cs.cas.cz
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.