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.

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 optim. Defaults to 1e3. Set to higher values if convergence problems are reported.

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 (lambda as in rpois, dpois, ppois, qpois).

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


[Package bootComb version 1.0.1 Index]