getPoisFromCI {bootComb} | R Documentation |
Find the best-fit Poisson distribution for a given confidence interval.
Description
Finds the best-fit Poisson distribution for a given confidence interval; returns the corresponding probability mass, distribution, quantile and sampling functions. The use of this function within the bootComb package is limited: this is a discrete distribution but since users provide confidence intervals, the corresponding parameters will be best approximated by continuous distributions.
Usage
getPoisFromCI(qLow, qUpp, alpha = 0.05, initPars = 5, maxiter = 1000)
Arguments
qLow |
The observed lower quantile. |
qUpp |
The observed upper quantile. |
alpha |
The confidence level; i.e. the desired coverage is 1-alpha. Defaults to 0.05. |
initPars |
A vector of length 1 giving the initial parameter value (rate parameter) to start the optimisation; defaults to 5. |
maxiter |
Maximum number of iterations for |
Value
A list with 5 elements:
r |
The sampling function. |
d |
The probability mass function. |
p |
The distribution function. |
q |
The quantile function. |
pars |
A single number giving the rate parameter for the best-fit Poisson distribution ( |
See Also
identifyPoisPars
, optim
, dpois
Examples
n<-getPoisFromCI(qLow=9,qUpp=22)
print(n$par) # the fitted parameter value (lambda)
n$r(10) # 10 random values from the fitted Poisson distribution
n$d(6) # the probability mass at x=6 for the Poisson distribution
n$p(7) # the cumulative probability at x=7 for the fitted Poisson distribution
n$q(c(0.25,0.5,0.75)) # the 25th, 50th (median) and 75th percentiles of the fitted distribution
x<-0:40
y<-n$d(x)
barplot(height=y,names.arg=x,xlab="",ylab="probability mass") # bar plot of the fitted Poisson pmf