A toolbox for testing if a probability distribution fits a power law, including fitting power laws, comparing to other distributions via likelihood ratio tests, and plotting. Current version is 2.0.0 (released 2023-12-31), with major refactor from v1.x. Release cadence is irregular.
pip install powerlawVerified import paths — ran on the pinned version, not inferred.
Fit a power law to data and compare to alternative distributions.
Review the new API: `Fit` now directly returns the fitted parameters (alpha, xmin) as attributes. Use `fit.distribution_compare(...)` for comparisons.
See the documentation for new plotting methods; they have similar names but may have different signatures.
Ensure your data is strictly positive (e.g., remove zeros and negative values before fitting).
Use `import powerlaw` and then `fit = powerlaw.Fit(data)`.
Use `fit = powerlaw.Fit(data, xmin=...)` and refer to v2.0 docs; if using v2.0, the argument is still supported but check for other changes.
Filter your data: `data = data[data > 0]` before fitting.
No dependency data recorded yet.