Learn R Programming

actuar (version 3.3-4)

ZeroModifiedGeometric: The Zero-Modified Geometric Distribution

Description

Density function, distribution function, quantile function and random generation for the Zero-Modified Geometric distribution with parameter prob and arbitrary probability at zero p0.

Usage

dzmgeom(x, prob, p0, log = FALSE)
pzmgeom(q, prob, p0, lower.tail = TRUE, log.p = FALSE)
qzmgeom(p, prob, p0, lower.tail = TRUE, log.p = FALSE)
rzmgeom(n, prob, p0)

Value

dzmgeom gives the (log) probability mass function,

pzmgeom gives the (log) distribution function,

qzmgeom gives the quantile function, and

rzmgeom 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

rzmgeom, and is the maximum of the lengths of the numerical arguments for the other functions.

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 \le x]\), otherwise, \(P[X > x]\).

Author

Vincent Goulet vincent.goulet@act.ulaval.ca

Details

The zero-modified geometric distribution with prob \(= p\) and p0 \(= p_0\) is a discrete mixture between a degenerate distribution at zero and a (standard) geometric. The probability mass function is \(p(0) = p_0\) and $$% p(x) = \frac{(1-p_0)}{(1-p)} f(x)$$ for \(x = 1, 2, \ldots\), \(0 < p < 1\) and \(0 \le p_0 \le 1\), where \(f(x)\) is the probability mass function of the geometric. The cumulative distribution function is $$P(x) = p_0 + (1 - p_0) \left(\frac{F(x) - F(0)}{1 - F(0)}\right)$$

The mean is \((1-p_0) \mu\) and the variance is \((1-p_0) \sigma^2 + p_0(1-p_0) \mu^2\), where \(\mu\) and \(\sigma^2\) are the mean and variance of the zero-truncated geometric.

In the terminology of Klugman et al. (2012), the zero-modified geometric is a member of the \((a, b, 1)\) class of distributions with \(a = 1-p\) and \(b = 0\).

The special case p0 == 0 is the zero-truncated geometric.

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

The quantile is defined as the smallest value \(x\) such that \(P(x) \ge p\), where \(P\) is the distribution function.

References

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

See Also

dgeom for the geometric distribution.

dztgeom for the zero-truncated geometric distribution.

dzmnbinom for the zero-modified negative binomial, of which the zero-modified geometric is a special case.

Examples

Run this code
p <- 1/(1 + 0.5)
dzmgeom(1:5, prob = p, p0 = 0.6)
(1-0.6) * dgeom(1:5, p)/pgeom(0, p, lower = FALSE) # same

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

qzmgeom(pzmgeom(0:10, 0.3, p0 = 0.6), 0.3, p0 = 0.6)

Run the code above in your browser using DataLab