A practical toolkit to detect, test, and reason about power-law environments.
This repo helps answer one question:
Are my outcomes governed by a power law, or do they just look that way?
It is designed for founders, investors, and researchers who care about asymmetric payoffs, winner-take-most dynamics, and convex bets.
Power Law Lab has two core parts:
Given a dataset of outcomes (profits, views, ROI, returns, etc.), it:
- Measures concentration (top 1%, top 10%, Gini, Herfindahl)
- Fits tail models:
- Power law
- Lognormal
- Exponential
- Automatically finds a tail cutoff (
xmin) - Produces visual diagnostics (log-log CCDF)
- Outputs a clear verdict:
powerlaw_tail_likelyheavy_tail_likelyheavy_tail_likely_ambiguousunknown
This tells you what kind of world you are operating in.
A companion script lets you create controlled datasets:
- Pure power law
- Lognormal
- Normal (thin tail)
- Exponential
- Blended systems (e.g. 70% lognormal + 30% power law)
This is useful for:
- Learning how tails behave
- Testing false positives
- Stress-testing intuition
- Teaching others
.
├── powerlaw_lab.py # Main analysis + bet scoring tool
├── make_synthetic_input.py # Synthetic data generator
├── README.md
└── LICENSE
Python 3.9+
pip install -r requirements-excel.txtOptional (for Excel support):
pip install openpyxlCSV or Excel file with:
unit_id,outcome
1,3.24
2,0.91
3,145.7
...
unit_idcan be anything (client, post, deal, strategy)outcomemust be numeric and positive
Column names can be overridden via CLI flags.
python powerlaw_lab.py analyze data.csv --auto_xminOutputs:
summary.jsonccdf_loglog.pnghist_logx.png
python powerlaw_lab.py analyze data.xlsx \
--sheet Sheet1 \
--value_col profit \
--unit_col deal_id \
--auto_xminKey signals that indicate a power-law environment:
- Top 1% contributes 20–40%+ of total outcome
- Gini coefficient > ~0.5
- Power law beats exponential clearly
- Tail size is large and stable across runs
- CCDF looks linear on log-log axes above
xmin
This is not proof. It is a decision tool.
python make_synthetic_input.py generate \
--dist powerlaw \
--n 20000 \
--params xmin=1,alpha=2.2 \
--out synthetic_powerlaw.csvpython make_synthetic_input.py generate \
--dist lognormal \
--params mu=0,sigma=1.0 \
--out synthetic_lognormal.csvpython make_synthetic_input.py blend \
--dist_a lognormal --params_a mu=0,sigma=0.8 \
--dist_b powerlaw --params_b xmin=1,alpha=2.2 \
--w 0.7 \
--out synthetic_shift.csvw controls the mix:
w = 1.0→ pure Aw = 0.0→ pure B
There is also an interactive bet scoring tool:
python powerlaw_lab.py score_betsYou score ideas 0–2 on:
- Upside ceiling
- Downside cap
- Leverage
- Feedback speed
- Distribution edge
Output is a ranked CSV.
This helps you allocate attention to convex bets.
- It does not prove universal laws.
- It does not predict individual outcomes.
- It does not replace judgment.
It helps you avoid the biggest mistake:
Treating a lognormal or normal world like a power-law world.
This tool is useful if you are working on:
- Startups
- Content distribution
- Investing
- Trading strategies
- Product usage
- Deal sourcing
- Any system with rare big wins
MIT License (recommended)
- Free to use
- Free to modify
- Free for commercial use
- Attribution required
- No warranty
See LICENSE file.
Power laws change how you allocate time, capital, and risk.
This tool exists to make that visible.
Use it to take fewer bets, but bigger ones.
---