ZeroModifiedLogarithmic | R Documentation |
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
.
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)
x |
vector of (strictly positive integer) quantiles. |
q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. If |
prob |
parameter. |
p0 |
probability mass at zero. |
log, log.p |
logical; if |
lower.tail |
logical; if |
The zero-modified logarithmic distribution with prob
= p
and p0
= p_0
is a discrete mixture between a
degenerate distribution at zero and a (standard) logarithmic. The
probability mass function is p(0) = p_0
and
%
p(x) = (1-p_0) 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 logarithmic.
The cumulative distribution function is
P(x) = p_0 + (1 - p_0) 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) \ge p
, where F
is the distribution function.
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.
Functions {d,p,q}zmlogarithmic
use
{d,p,q}logarithmic
for all but the trivial input values and
p(0)
.
Vincent Goulet vincent.goulet@act.ulaval.ca
Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.
dlogarithmic
for the logarithmic distribution.
dztnbinom
for the zero modified negative binomial
distribution.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.