Description Usage Arguments Value See Also Examples
View source: R/fitDistributionsToCIs.R
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.
1 | getPoisFromCI(qLow, qUpp, alpha = 0.05, initPars = 5, maxiter = 1000)
|
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 |
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 ( |
identifyPoisPars
, optim
, dpois
1 2 3 4 5 6 7 8 9 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.