Learn R Programming

VGAM (version 1.0-5)

Oilog: One-Inflated Logarithmic Distribution

Description

Density, distribution function, quantile function and random generation for the one-inflated logarithmic distribution with parameter pstr1.

Usage

doilog(x, shape, pstr1 = 0, log = FALSE)
poilog(q, shape, pstr1 = 0)
qoilog(p, shape, pstr1 = 0)
roilog(n, shape, pstr1 = 0)

Arguments

x, q, p, n

Same as Uniform.

shape

Vector of parameters that lie in \((0,1)\).

pstr1

Probability of a structural one (i.e., ignoring the logarithmic distribution), called \(\phi\). The default value of \(\phi = 0\) corresponds to the response having an ordinary logarithmic distribution.

log

Same as Uniform.

Value

doilog gives the density, poilog gives the distribution function, qoilog gives the quantile function, and roilog generates random deviates.

Details

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.

See Also

oilog, rlog, logff, Otlog.

Examples

Run this code
# NOT RUN {
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 = paste("OILogff(", shape, ", pstr1 = ", pstr1, ") (blue) vs",
                     " Logff(", shape, ") (orange)", sep = ""),
        names.arg = as.character(x))

deflat.limit <- -dlog(1, shape) / plog(1, shape, lower.tail = FALSE)
newpstr1 <- round(deflat.limit, 3) + 0.001  # Inside but near the boundary
barplot(rbind(doilog(x, shape, pstr1 = newpstr1),
                dlog(x, shape)),
        beside = TRUE, col = c("blue","orange"),
        main = paste("ODLogff(", shape, ", pstr1 = ", newpstr1, ") (blue) vs",
                     " Logff(", shape, ") (orange)", sep = ""),
        names.arg = as.character(x)) 
# }

Run the code above in your browser using DataLab