qmap (version 1.0-4)

bernlnorm: The Bernoulli-Log-Normal distribution

Description

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

Usage

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.

Value

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

Details

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

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

Run this code
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)

Run the code above in your browser using DataLab