Skip to content

Zipf Library

Functions for working with Zipf metrics.

Functions

Function Description
byRank(counts) Measure the Zipf slope of a set of counts, ranked from largest to smallest.
bySize(sizes, counts) Measure the Zipf slope of a set of counts plotted against given sizes.
checkRanksAndCounts(ranks, counts) Check that ranks and counts are valid for a Zipf measurement.
getSlopeR2(ranks, counts) Fit a Zipf trendline to a set of ranks and counts.
measureScore(scores, metrics) Measure a list of scores against a list of Zipf metrics.
measureMidi(files, metrics) Measure a list of MIDI files against a list of Zipf metrics.
measureDataByRank(datasets) Measure a list of count datasets by rank.
measureDataBySize(datasets) Measure a list of size-and-count datasets.
writeCSV(measurements, filename) Write measurements to a CSV file.