bernlnorm: The Bernoulli-Log-Normal distribution

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

Description

Density, distribution function, quantile function and random generation for the Bernoulli-Log-Normal distribution with parameters prob, meanlog, and sdlog.

Usage

1
2
3
4
dbernlnorm(x, prob, meanlog, sdlog)
pbernlnorm(q, prob, meanlog, sdlog)
qbernlnorm(p, prob, meanlog, sdlog)
rbernlnorm(n, prob, meanlog, sdlog)

Arguments

x,q

vector of quantiles.

p

vector of probabilities.

prob

probability of non-zero event.

n

number of random samples.

meanlog,sdlog

meanlog and sdlog parameters of the Log-Normal distribution.

Details

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

Value

dbernlnorm gives the density (pdf), pbernlnorm gives the distribution function (cdf), qbernlnorm gives the quantile function (inverse cdf), and rbernlnorm generates random deviates.

Note

The implementation is largely based on the blnorm family in the CaDENCE-package (Cannon, 2012) that was only available as test version at time of implementation (Mar. 2012). The CaDENCE-package is available at http://www.eos.ubc.ca/~acannon/CaDENCE/.

Author(s)

Lukas Gudmundsson

References

Cannon, A. J. Neural networks for probabilistic environmental prediction: Conditional Density Estimation Network Creation and Evaluation (CaDENCE) in R. Computers & Geosciences, 2012, 41, 126 - 135, doi:10.1016/j.cageo.2011.08.023.

See Also

Lognormal, 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
29
30
31
data(obsprecip)

(ts <- startbernlnorm(obsprecip[,1]))
hist(obsprecip[,1],freq=FALSE)
lines(seq(0,20),dbernlnorm(0:20,
                           prob=ts$prob,
                           meanlog=ts$meanlog,
                           sdlog=ts$sdlog),
      col="red")

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

plot(qq,pp)
lines(qbernlnorm(pp,
                 prob=ts$prob,
                 meanlog=ts$meanlog,
                 sdlog=ts$sdlog),
      pp,col="red")

plot(qq,pp)
lines(qq,
      pbernlnorm(qq,
                 prob=ts$prob,
                 meanlog=ts$meanlog,
                 sdlog=ts$sdlog),
      col="red")

hist(rbernlnorm(1000,prob=ts$prob,
                meanlog=ts$meanlog,
                sdlog=ts$sdlog),freq=FALSE)

qmap documentation built on May 1, 2019, 7:31 p.m.