zmll: Maximum Likelihood Estimation for Zipf-Mandelbrot Models

zm.llR Documentation

Maximum Likelihood Estimation for Zipf-Mandelbrot Models

Description

Performs maximum likelihood estimation for the parameters of the Zipf, Zipf-Mandelbrot, and zeta distributions.

Usage

zm.ll(x, N = NULL, s = 1, b = 1, dist = c("Zipf", "Zipf-Man", 
      "Zeta"), ...) 

Arguments

x

A vector of raw data or a table of counts which is distributed according to a Zipf, Zipf-Mandelbrot, or zeta distribution. Do not supply a vector of counts!

N

The number of categories when dist = "Zipf" or dist = "Zipf-Man". This is not used when dist = "Zeta". If N = NULL, then N is estimated based on the number of categories observed in the data.

s

The initial value to estimate the shape parameter, which is set to 1 by default. If a poor initial value is specified, then a WARNING message is returned.

b

The initial value to estimate the second shape parameter when dist = "Zipf-Man", which is set to 1 by default. If a poor initial value is specified, then a WARNING message is returned.

dist

Options are dist = "Zipf", dist = "Zipf-Man", or dist = "Zeta" if the data is distributed according to the Zipf, Zipf-Mandelbrot, or zeta distribution, respectively.

...

Additional arguments passed to the mle function.

Details

Zipf-Mandelbrot models are commonly used to model phenomena where the frequencies of categorical data are approximately inversely proportional to its rank in the frequency table.

Value

See the help file for mle to see how the output is structured.

Note

This function may be updated in a future version of the package so as to allow greater flexibility with the inputs.

References

Mandelbrot, B. B. (1965), Information Theory and Psycholinguistics. In B. B. Wolman and E. Nagel, editors. Scientific Psychology, Basic Books.

Zipf, G. K. (1949), Human Behavior and the Principle of Least Effort, Hafner.

Zornig, P. and Altmann, G. (1995), Unified Representation of Zipf Distributions, Computational Statistics and Data Analysis, 19, 461–473.

See Also

mle, ZipfMandelbrot

Examples

## Maximum likelihood estimation for randomly generated data
## from the Zipf, Zipf-Mandelbrot, and zeta distributions. 

set.seed(100)

s <- 2
b <- 5
N <- 50

zipf.data <- rzipfman(n = 500, s = s, N = N)
out.zipf <- zm.ll(zipf.data, N = N, dist = "Zipf")
stats4::coef(out.zipf)
stats4::vcov(out.zipf)

zipfman.data <- rzipfman(n = 500, s = s, b = b, N = N)
out.zipfman <- zm.ll(zipfman.data, N = N, dist = "Zipf-Man")
stats4::coef(out.zipfman)
diag(stats4::vcov(out.zipfman))

zeta.data <- rzipfman(n = 200, s = s, N = Inf)
out.zeta <- zm.ll(zeta.data, N = Inf, dist = "Zeta")
stats4::coef(out.zeta)
stats4::vcov(out.zeta)

tolerance documentation built on May 29, 2024, 7:38 a.m.