VGAM (version 1.0-4)

Oizipf: One-Inflated Zipf Distribution

Description

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

Usage

doizipf(x, N, shape, pstr1 = 0, log = FALSE)
poizipf(q, N, shape, pstr1 = 0)
qoizipf(p, N, shape, pstr1 = 0)
roizipf(n, N, shape, pstr1 = 0)

Arguments

x, q, p, n

Same as Uniform.

N, shape

See Zipf.

pstr1

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

log

Same as Uniform.

Value

doizipf gives the density, poizipf gives the distribution function, qoizipf gives the quantile function, and roizipf generates random deviates.

Details

The probability function of \(Y\) is 1 with probability \(\phi\), and \(Zipf(N, s)\) with probability \(1-\phi\). Thus $$P(Y=1) =\phi + (1-\phi) P(W=1)$$ where \(W\) is distributed as a \(Zipf(N, s)\) random variable. The VGAM family function oizeta estimates the two parameters of this model by Fisher scoring.

See Also

oizeta. Zipf, zipf, Oizeta.

Examples

Run this code
# NOT RUN {
N <- 10; shape <- 1.5; pstr1 <- 0.3; x <- (-1):N
(ii <- doizipf(x, N, shape, pstr1 = pstr1))

# }
# NOT RUN {
 x <- 0:10
par(mfrow = c(2, 1))  # One-Inflated zipf
barplot(rbind(doizipf(x, N, shape, pstr1 = pstr1), dzipf(x, N, shape)),
        beside = TRUE, col = c("blue", "orange"),
        main = paste("OIZipf(", N, ", ", shape, ", pstr1 = ", pstr1, ") (blue) vs",
                     " Zipf(", N, ", ", shape, ") (orange)", sep = ""),
        names.arg = as.character(x))

deflat.limit <- -dzipf(1, N, shape) / (1 - dzipf(1, N, shape))
newpstr1 <- round(deflat.limit, 3) + 0.001  # Inside but near the boundary
barplot(rbind(doizipf(x, N, shape, pstr1 = newpstr1),
                dzipf(x, N, shape)),
        beside = TRUE, col = c("blue", "orange"),
        main = paste("ODZipf(", N, ", ", shape, ", pstr1 = ", newpstr1, ") (blue) vs",
                     " Zipf(", N, ", ", shape, ") (orange)", sep = ""),
        names.arg = as.character(x)) 
# }

Run the code above in your browser using DataLab