Oilog {VGAM} | R Documentation

## 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`.

### 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.

### Value

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

### Note

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.

### Author(s)

T. W. Yee

### See Also

`oilog`, `rlog`, `logff`, `Otlog`.

### Examples

    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))
    ## End(Not run)

[Package VGAM version 1.0-4 Index]