getExpFromCI {bootComb}R Documentation

Find the best-fit exponential distribution for a given confidence interval.

Description

Finds the best-fit exponential distribution for a given confidence interval; returns the corresponding density, distribution, quantile and sampling functions.

Usage

getExpFromCI(qLow, qUpp, alpha = 0.05, initPars = 1, 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 single number giving the initial rate parameter value to start the optimisation; defaults to 1.

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 density function.

p

The distribution function.

q

The quantile function.

pars

A single number giving the rate parameter for the best-fit exponential distribution (rate as in rexp, dexp, pexp, qexp).

See Also

identifyExpPars, optim, dexp

Examples

n<-getExpFromCI(qLow=0.01,qUpp=1.75)
print(n$pars) # the fitted rate parameter value
n$r(10) # 10 random values from the fitted exponential distribution
n$d(2) # the probability density at x=2 for the exponential distribution
n$p(1.5) # the cumulative density at x=1.5 for the fitted exponential distribution
n$q(c(0.25,0.5,0.75)) # the 25th, 50th (median) and 75th percentiles of the fitted distribution
x<-seq(0,5,length=1e3)
y<-n$d(x)
plot(x,y,type="l",xlab="",ylab="density") # density plot for the fitted exponential distribution


[Package bootComb version 1.1.2 Index]