{"document_url": "https://en.wikipedia.org/wiki/Zipf%27s_law"}
Probability distribution
Zipf's law (/zɪf/, German: [ts͡ɪpf]) is an empirical law formulated using mathematical statistics that refers to the fact that for many types of data studied in the physical and social sciences, the rank-frequency distribution is an inverse relation. The Zipfian distribution is one of a family of related discrete power law probability distributions. It is related to the zeta distribution, but is not identical.

Zipf's law was originally formulated in terms of quantitative linguistics, stating that given some corpus of natural language utterances, the frequency of any word is inversely proportional to its rank in the frequency table. Thus the most frequent word will occur approximately twice as often as the second most frequent word, three times as often as the third most frequent word, etc. For example, in the Brown Corpus of American English text, the word "the" is the most frequently occurring word, and by itself accounts for nearly 7% of all word occurrences (69,971 out of slightly over 1 million). True to Zipf's Law, the second-place word "of" accounts for slightly over 3.5% of words (36,411 occurrences), followed by "and" (28,852). Only 135 vocabulary items are needed to account for half the Brown Corpus.

The law is named after the American linguist George Kingsley Zipf, who popularized it and sought to explain it, though he did not claim to have originated it. The French stenographer Jean-Baptiste Estoup appears to have noticed the regularity before Zipf. It was also noted in 1913 by German physicist Felix Auerbach.

The law is similar in concept, though not identical in distribution, to Benford's law.

Other data sets

The same relationship occurs in many other rankings of human-created systems, such as the ranks of mathematical expressions or ranks of notes in music and even in uncontrolled environments, such as corporation sizes, income rankings, ranks of number of people watching the same TV channel, cells' transcriptomes and so on. The appearance of the distribution in rankings of cities by population was first noticed by Felix Auerbach in 1913, leading to a broad literature of Zipf's law for cities. However, more recent empirical and theoretical studies have challenged the relevance of Zipf's law for cities.

Empirically, a data set can be tested to see whether Zipf's law applies by checking the goodness of fit of an empirical distribution to the hypothesized power law distribution with a Kolmogorov–Smirnov test, and then comparing the (log) likelihood ratio of the power law distribution to alternative distributions like an exponential distribution or lognormal distribution.

Theoretical review

Zipf's law is most easily observed by plotting the data on a log-log graph, with the axes being the logarithm of rank order, and logarithm of frequency. For example, as described in the introduction, the word "the" would appear at x = log(1) (order rank = 1), and y = log(69 971). It is also possible to plot reciprocal rank against frequency or reciprocal frequency or interword interval against rank. The data conform to Zipf's law to the extent that the plot is linear.

Formally, define:

N   to be the number of elements;
k     their rank;
s     the value of the exponent characterizing the distribution (s at least 1).

Zipf's law then predicts that out of a population of N elements, the element of order rank k, has the normalized frequency f ( k; s, N ) :
Zipf's law holds if the number of elements with a given frequency is a random variable with power law distribution
( fk is the value of the expression immediately above).

It has been claimed that this representation of Zipf's law is more suitable for statistical testing, and in this way it has been analyzed in more than 30,000 English texts. The goodness-of-fit tests yield that only about 15% of the texts are statistically compatible with this form of Zipf's law. Slight variations in the definition of Zipf's law can increase this percentage up to close to 50%.

In the example of the frequency of words in the English language, N is the number of words in the English language and, if we use the classic version of Zipf's law, the characterizing exponent s is 1 (minimum possible). The value f ( k; s, N ) will then be the fraction of the time the kth most common word occurs.

The law may also be written:
where HN,s is the N‑th generalized harmonic number.

The simplest case of Zipf's law is a "1/  f  " function, with s = 1 . Given a set of Zipf-distributed frequencies, sorted from most common to least common, the second most common frequency will occur half as often as the first, the third most common frequency will occur 1/ 3  as often as the first, and the n‑th most common frequency will occur 1/ n  as often as the first. However, this cannot hold exactly: Because items must occur an integer number of times, there cannot be 2.5 occurrences of a word. Nevertheless, over fairly wide ranges, and to a fairly good approximation, many natural phenomena obey Zipf's law.

In human languages, word frequencies have a very heavy-tailed distribution, and can therefore be modeled reasonably well by a Zipf distribution with an s close to 1.

As long as the exponent s exceeds 1, it is possible for such a law to hold with infinitely many words, since if s > 1 then
where ζ is Riemann's zeta function.

Statistical explanation
Although Zipf's Law holds for all languages, even non-natural ones like Esperanto, the reason is still not well understood. However, it may be partially explained by the statistical analysis of randomly generated texts. Wentian Li has shown that in a document in which each character has been chosen randomly from a uniform distribution of all letters (plus a space character), the "words" with different lengths follow the macro-trend of the Zipf's law (the more probable words are the shortest with equal probability). Vitold Belevitch, in a paper entitled On the Statistical Laws of Linguistic Distribution, offers a mathematical derivation. He took a large class of well-behaved statistical distributions (not only the normal distribution) and expressed them in terms of rank. He then expanded each expression into a Taylor series. In every case Belevitch obtained the remarkable result that a first-order truncation of the series resulted in Zipf's law. Further, a second-order truncation of the Taylor series resulted in Mandelbrot's law.

The principle of least effort is another possible explanation: Zipf himself proposed that neither speakers nor hearers using a given language want to work any harder than necessary to reach understanding, and the process that results in approximately equal distribution of effort leads to the observed Zipf distribution.

Similarly, preferential attachment (intuitively, "the rich get richer" or "success breeds success") that results in the Yule–Simon distribution has been shown to fit word frequency versus rank in language and population versus city rank better than Zipf's law. It was originally derived to explain population versus rank in species by Yule, and applied to cities by Simon.

Mathematical explanation

Atlas models are systems of exchangeable positive-valued diffusion processes with drift and variance parameters that depend only on the rank of the process. It has been shown mathematically that Zipf's law holds for Atlas models that satisfy certain natural regularity conditions. Atlas models can be used to represent empirical systems of time-dependent multivariate data, including, e.g., the frequency of words in a written language or the size of companies. An Atlas model that represents an empirical system will have the same stationary distribution as the empirical system, so if the Atlas model follows Zipf's law, the system will also follow Zipf's law. Since Atlas models that satisfy natural regularity conditions follow Zipf's law, this accounts for its universality.

In the figure above of the 10 million Wikipedia words, the log-log plots are not precisely straight lines but rather slightly concave curves with a tangent of slope -1 at some point along the curve. Such distributions are usually referred to as quasi-Zipfian distributions, and most systems of time-dependent empirical data that are said to follow Zipf's law are actually quasi-Zipfian. Quasi-Zipfian systems can be represented by quasi-Atlas models, and quasi-Atlas models are amenable to mathematical treatment similar to that for Zipf's law.

Related laws
Zipf's law in fact refers more generally to frequency distributions of "rank data", in which the relative frequency of the nth-ranked item is given by the zeta distribution, 1/(nsζ(s)), where the parameter s > 1 indexes the members of this family of probability distributions. Indeed, Zipf's law is sometimes synonymous with "zeta distribution", since probability distributions are sometimes called "laws". This distribution is sometimes called the Zipfian distribution.

A generalization of Zipf's law is the Zipf–Mandelbrot law, proposed by Benoit Mandelbrot, whose frequencies are:
The "constant" is the reciprocal of the Hurwitz zeta function evaluated at s. In practice, as easily observable in distribution plots for large corpora, the observed distribution can be modelled more accurately as a sum of separate distributions for different subsets or subtypes of words that follow different parameterizations of the Zipf–Mandelbrot distribution, in particular the closed class of functional words exhibit s lower than 1, while open-ended vocabulary growth with document size and corpus size require s greater than 1 for convergence of the Generalized Harmonic Series.

Zipfian distributions can be obtained from Pareto distributions by an exchange of variables.

The Zipf distribution is sometimes called the discrete Pareto distribution because it is analogous to the continuous Pareto distribution in the same way that the discrete uniform distribution is analogous to the continuous uniform distribution.

The tail frequencies of the Yule–Simon distribution are approximately
for any choice of ρ > 0.

In the parabolic fractal distribution, the logarithm of the frequency is a quadratic polynomial of the logarithm of the rank. This can markedly improve the fit over a simple power-law relationship. Like fractal dimension, it is possible to calculate Zipf dimension, which is a useful parameter in the analysis of texts.

It has been argued that Benford's law is a special bounded case of Zipf's law, with the connection between these two laws being explained by their both originating from scale invariant functional relations from statistical physics and critical phenomena. The ratios of probabilities in Benford's law are not constant. The leading digits of data satisfying Zipf's law with s = 1 satisfy Benford's law.
Applications

In information theory, a symbol (event, signal) of probability
contains
bits of information. Hence, Zipf's law for natural numbers:
is equivalent with number
containing
bits of information. To add information from a symbol of probability
into information already stored in a natural number
, we should go to
such that
, or equivalently
. For instance, in standard binary system we would have
, what is optimal for
probability distribution. Using
rule for a general probability distribution is the base of [[asymmetric numeral system]s] family of entropy coding methods used in data compression, whose state distribution is also governed by Zipf's law.

Zipf's law has been used for extraction of parallel fragments of texts out of comparable corpora. Zipf's law has also been used by Laurance Doyle and others at the SETI Institute as part of the search for extraterrestrial intelligence.

The Voynich Manuscript, which is a 15th-century codex, also falls in line with Zipf's law, indicating that text is most likely not a hoax but rather written in an obscure language or cipher.