bernexp: The Bernoulli-Exponential distribution

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Density, distribution function, quantile function and random generation for the Bernoulli-Exponential distribution with parameters prob, and rate.

Usage

1
2
3
4
dbernexp(x, prob, rate)
pbernexp(q, prob, rate)
qbernexp(p, prob, rate)
rbernexp(n, prob, rate)

Arguments

x,q

vector of quantiles.

p

vector of probabilities.

prob

probability of non-zero event.

n

number of random samples.

rate

rate parameter of the Exponential distribution.

Details

Mixture of the Bernoulli and the Exponential distribution. The mixture is analogue to the one described for the berngamma distribution.

Value

dbernexp gives the density (pdf), pbernexp gives the distribution function (cdf), qbernexp gives the quantile function (inverse cdf), and rbernexp generates random numbers.

Author(s)

Lukas Gudmundsson

See Also

Exponential, berngamma

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
data(obsprecip)

(ts <- startbernexp(obsprecip[,1]))
hist(obsprecip[,1],freq=FALSE) 
lines(seq(0,max(obsprecip[,1])),
      dbernexp(seq(0,max(obsprecip[,1])),
               prob=ts$prob,
               rate=ts$rate),
      col="red")

pp <- seq(0.01,0.99,by=0.01)
qq <-quantile(obsprecip[,1],probs=pp) 

plot(qq,pp)
lines(qbernexp(pp,
               prob=ts$prob,
               rate=ts$rate),
      pp,col="red")

plot(qq,pp)
lines(qq,
      pbernexp(qq,
               prob=ts$prob,
               rate=ts$rate),
      col="red")

hist(rbernexp(1000,prob=ts$prob,
              rate=ts$rate),freq=FALSE)

qmap documentation built on May 29, 2017, 9:48 a.m.