Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ZeroModifiedLogarithmic

The Zero-Modified Logarithmic Distribution


Description

Density function, distribution function, quantile function and random generation for the Zero-Modified Logarithmic (or log-series) distribution with parameter prob and arbitrary probability at zero p0.

Usage

dzmlogarithmic(x, prob, p0, log = FALSE)
pzmlogarithmic(q, prob, p0, lower.tail = TRUE, log.p = FALSE)
qzmlogarithmic(p, prob, p0, lower.tail = TRUE, log.p = FALSE)
rzmlogarithmic(n, prob, p0)

Arguments

x

vector of (strictly positive integer) quantiles.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

prob

parameter. 0 <= prob < 1.

p0

probability mass at zero. 0 <= p0 <= 1.

log, log.p

logical; if TRUE, probabilities p are returned as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].

Details

The zero-modified logarithmic distribution with prob = p and p0 = p0 is a discrete mixture between a degenerate distribution at zero and a (standard) logarithmic. The probability mass function is p(0) = p0 and

p(x) = (1-p0) f(x)

for x = 1, 2, …, 0 < p < 1 and 0 ≤ p0 ≤ 1, where f(x) is the probability mass function of the logarithmic. The cumulative distribution function is

P(x) = p0 + (1 - p0) F(x).

The special case p0 == 0 is the standard logarithmic.

The zero-modified logarithmic distribution is the limiting case of the zero-modified negative binomial distribution with size parameter equal to 0. Note that in this context, parameter prob generally corresponds to the probability of failure of the zero-truncated negative binomial.

If an element of x is not integer, the result of dzmlogarithmic is zero, with a warning.

The quantile is defined as the smallest value x such that F(x) ≥ p, where F is the distribution function.

Value

dzmlogarithmic gives the probability mass function, pzmlogarithmic gives the distribution function, qzmlogarithmic gives the quantile function, and rzmlogarithmic generates random deviates.

Invalid prob or p0 will result in return value NaN, with a warning.

The length of the result is determined by n for rzmlogarithmic, and is the maximum of the lengths of the numerical arguments for the other functions.

Note

Functions {d,p,q}zmlogarithmic use {d,p,q}logarithmic for all but the trivial input values and p(0).

Author(s)

References

Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.

See Also

dlogarithmic for the logarithmic distribution.

dztnbinom for the zero modified negative binomial distribution.

Examples

p <- 1/(1 + 0.5)
dzmlogarithmic(1:5, prob = p, p0 = 0.6)
(1-0.6) * dlogarithmic(1:5, p)/plogarithmic(0, p, lower = FALSE) # same

## simple relation between survival functions
pzmlogarithmic(0:5, p, p0 = 0.2, lower = FALSE)
(1-0.2) * plogarithmic(0:5, p, lower = FALSE)/plogarithmic(0, p, lower = FALSE) # same

qzmlogarithmic(pzmlogarithmic(0:10, 0.3, p0 = 0.6), 0.3, p0 = 0.6)

actuar

Actuarial Functions and Heavy Tailed Distributions

v3.1-2
GPL (>= 2)
Authors
Vincent Goulet [cre, aut], Sébastien Auclair [ctb], Christophe Dutang [aut], Nicholas Langevin [ctb], Xavier Milhaud [ctb], Tommy Ouellet [ctb], Alexandre Parent [ctb], Mathieu Pigeon [aut], Louis-Philippe Pouliot [ctb], Jeffrey A. Ryan [aut] (Package API), Robert Gentleman [aut] (Parts of the R to C interface), Ross Ihaka [aut] (Parts of the R to C interface), R Core Team [aut] (Parts of the R to C interface), R Foundation [aut] (Parts of the R to C interface)
Initial release
2021-03-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.