zipf-law
Code for metrics based on Zipf's Law (and related power laws).
Zipf's law models the scaling (fractal) properties of many phenomena in human ecology, including natural language and music (1). Zipf's law is one of many related laws that describe scaling properties of phenomena studied in the physical, biological, and behavioral sciences. These include Pareto's law, Lotka's law, power laws, Benford's law, Bradford's law, Heaps' law, etc.
This code allows you to calculate Zipf slopes and R squared values from event counts (histograms) of natural and human phenomena (i.e., histograms of unique events in a phenomenon).
For more information of Zipf's Law, see this quick intro -
http://www.cs.cofc.edu/~manaris/?n=Fall2005.ZipfIntro
Also see:
Zipf, G.K. (1949). Human Behavior and the Principle of Least Effort, Addison-Wesley Press, New York. https://www.amazon.com/Human-Behavior-Principle-Least-Effort/dp/161427312X