Oizipf | R Documentation |
Density, distribution function, quantile function and random
generation for the one-inflated Zipf distribution with parameter
pstr1
.
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)
x , q , p , n |
Same as |
N , shape |
See |
pstr1 |
Probability of a structural one
(i.e., ignoring the Zipf distribution),
called |
log |
Same as |
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.
doizipf
gives the density,
poizipf
gives the distribution function,
qoizipf
gives the quantile function, and
roizipf
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 Zipf
distribution. Here, pstr1
is also permitted to lie in the
interval [-dzipf(1, N, s) / (1 - dzipf(1, N, s)), 0]
.
The resulting probability of a unit count is less than
the nominal zipf value, and the use of pstr1
to stand
for the probability of a structural 1 loses its meaning.
When pstr1
equals
-dzipf(1, N, s) / (1 - dzipf(1, N, s))
this corresponds to the 1-truncated zipf distribution.
T. W. Yee
oizeta
.
Zipf
,
zipf
,
Oizeta
.
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 = paste0("OIZipf(", N, ", ", shape, ", pstr1 = ", pstr1,
") (blue) vs Zipf(", N, ", ", shape, ") (orange)"),
names.arg = as.character(x))
deflat.limit <- -dzipf(1, N, shape) / (1 - dzipf(1, N, shape))
newpstr1 <- round(deflat.limit, 3) + 0.001 # Near the boundary
barplot(rbind(doizipf(x, N, shape, pstr1 = newpstr1),
dzipf(x, N, shape)),
beside = TRUE, col = c("blue", "orange"),
main = paste0("ODZipf(", N, ", ", shape, ", pstr1 = ", newpstr1,
") (blue) vs Zipf(", N, ", ", 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.