Learn R Programming

actuar (version 3.3-4)

ZeroTruncatedGeometric: The Zero-Truncated Geometric Distribution

Description

Density function, distribution function, quantile function and random generation for the Zero-Truncated Geometric distribution with parameter prob.

Usage

dztgeom(x, prob, log = FALSE)
pztgeom(q, prob, lower.tail = TRUE, log.p = FALSE)
qztgeom(p, prob, lower.tail = TRUE, log.p = FALSE)
rztgeom(n, prob)

Value

dztgeom gives the (log) probability mass function,

pztgeom gives the (log) distribution function,

qztgeom gives the quantile function, and

rztgeom generates random deviates.

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

The length of the result is determined by n for

rztgeom, 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.

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-truncated geometric distribution with prob \(= p\) has probability mass function $$% p(x) = p (1-p)^{x - 1}$$ for \(x = 1, 2, \ldots\) and \(0 < p < 1\), and \(p(1) = 1\) when \(p = 1\). The cumulative distribution function is $$P(x) = \frac{F(x) - F(0)}{1 - F(0)},$$ where \(F(x)\) is the distribution function of the standard geometric.

The mean is \(1/p\) and the variance is \((1-p)/p^2\).

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

If an element of x is not integer, the result of dztgeom 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.

dztnbinom for the zero-truncated negative binomial, of which the zero-truncated geometric is a special case.

Examples

Run this code
p <- 1/(1 + 0.5)
dztgeom(c(1, 2, 3), prob = p)
dgeom(c(1, 2, 3), p)/pgeom(0, p, lower = FALSE) # same
dgeom(c(1, 2, 3) - 1, p)                        # same

pztgeom(1, prob = 1)        # point mass at 1

qztgeom(pztgeom(1:10, 0.3), 0.3)

Run the code above in your browser using DataLab