Oilog | R Documentation |
Density, distribution function, quantile function and random
generation for the one-inflated logarithmic distribution with
parameter pstr1
.
doilog(x, shape, pstr1 = 0, log = FALSE)
poilog(q, shape, pstr1 = 0)
qoilog(p, shape, pstr1 = 0)
roilog(n, shape, pstr1 = 0)
x , q , p , n |
Same as |
shape |
Vector of parameters that lie in |
pstr1 |
Probability of a structural one
(i.e., ignoring the logarithmic distribution),
called |
log |
Same as |
The probability function of Y
is 1 with probability
\phi
, and Logarithmic(prob)
with
probability 1-\phi
. Thus
P(Y=1) =\phi + (1-\phi) P(W=1)
where W
is distributed as a
Logarithmic(shape)
random variable.
The VGAM family function oilog
estimates
\phi
by MLE.
doilog
gives the density,
poilog
gives the distribution function,
qoilog
gives the quantile function, and
roilog
generates random deviates.
The argument pstr1
is recycled to the required length,
and usually has values which lie in the interval [0,1]
.
These functions actually allow for the zero-deflated
logarithmic distribution. Here, pstr1
is also permitted
to lie in the
interval [-dlog(1, shape) / (1 - dlog(1, shape)), 0]
.
The resulting probability of a unit count is less than
the nominal logarithmic value, and the use of pstr1
to
stand for the probability of a structural 1 loses its
meaning.
When pstr1
equals
-dlog(1, shape) / (1 - dlog(1, shape))
this corresponds to the 1-truncated logarithmic distribution.
T. W. Yee
Gaitdlog
,
oilog
,
rlog
,
logff
,
Otlog
.
shape <- 0.5; pstr1 <- 0.3; x <- (-1):7
(ii <- doilog(x, shape, pstr1 = pstr1))
max(abs(poilog(1:200, shape) -
cumsum(shape^(1:200) / (-(1:200) * log1p(-shape))))) # Should be 0
## Not run: x <- 0:10
par(mfrow = c(2, 1)) # One-Inflated logarithmic
barplot(rbind(doilog(x, shape, pstr1 = pstr1), dlog(x, shape)),
beside = TRUE, col = c("blue", "orange"),
main = paste0("OILogff(", shape, ", pstr1 = ", pstr1,
") (blue) vs Logff(", shape, ") (orange)"),
names.arg = as.character(x))
deflat.limit <- -dlog(1, shape) / plog(1, shape, lower.tail = FALSE)
newpstr1 <- round(deflat.limit, 3) + 0.001 # Near the boundary
barplot(rbind(doilog(x, shape, pstr1 = newpstr1),
dlog(x, shape)),
beside = TRUE, col = c("blue","orange"),
main = paste0("ODLogff(", shape, ", pstr1 = ", newpstr1,
") (blue) vs Logff(", shape, ") (orange)"),
names.arg = as.character(x))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.