Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

zipfUC

The Zipf Distribution


Description

Density, distribution function, quantile function and random generation for the Zipf distribution.

Usage

dzipf(x, N, shape, log = FALSE)
pzipf(q, N, shape, log.p = FALSE)
qzipf(p, N, shape)
rzipf(n, N, shape)

Arguments

x, q, p, n

Same as Poisson.

N, shape

the number of elements, and the exponent characterizing the distribution. See zipf for more details.

log, log.p

Same meaning as in Normal.

Details

This is a finite version of the zeta distribution. See zetaff for more details. In general, these functions runs slower and slower as N increases.

Value

dzipf gives the density, pzipf gives the cumulative distribution function, qzipf gives the quantile function, and rzipf generates random deviates.

Author(s)

T. W. Yee

See Also

Examples

N <- 10; shape <- 0.5; y <- 1:N
proby <- dzipf(y, N = N, shape = shape)
## Not run:  plot(proby ~ y, type = "h", col = "blue", ylab = "Probability",
     ylim = c(0, 0.2), main = paste("Zipf(N = ",N,", shape = ",shape,")", sep = ""),
     lwd = 2, las = 1) 
## End(Not run)
sum(proby)  # Should be 1
max(abs(cumsum(proby) - pzipf(y, N = N, shape = shape)))  # Should be 0

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.