Scipy distributions are weird. Maybe these will be less weird.
Let's look at the lognormal distribution. The wikipedia article states that they are parameterized by μ and σ, the mean and standard deviation of the underlying normal distribution. In this case, μ and σ can also be known as the location and scale parameters, respectively.
However, to create a lognormal distribution in scipy, you need three parameters: location, scale, and shape.
The tricky part is, however, is that "location" in scipy refers to an offset from zero, "shape" refers to σ, and the "scale" refers to
Point of all of this is that paramnormal is trying to make easy what scipy sometimes makes tricky.
So where as in scipy, you would do this:
import numpy
from scipy import stats
mu = 0.75
sigma = 1.25
dist = stats.lognorm(sigma, loc=0, scale=numpy.exp(mu))In paramnormal, you can do this:
import paramnormal
dist = paramnormal.lognormal(mu=0.75, sigma=1.25)You can even use Greek letters
dist = paramnormal.lognormal(μ=0.75, σ=1.25)All three snippets return the same scipy distribution objects and have the same numerical methods (e.g., cdf, pdf, rvs, ppf).
Paramnormal just provides a short cut that let's you only specify the traditional distribution parameters you read about in your text book.
We have HTML docs built with sphinx.
Binaries are available through my conda channel
conda install --channel=phobson paramnormal
This is a pure python package, so installation from source should be as easy as running
pip install . (or uv pip install .) from the source directory if you've cloned the repo.
Otherwise, pip install paramnormal or pip install git+https://github.com/phobson/paramnormal.git will work.
This project is managed with uv:
uv sync # create .venv with dev dependencies
uv run pytest # run the tests
uv run ruff check . && uv run ruff format --check .
uv run --group docs sphinx-build -b html docs docs/_build/htmlThen view the docs with:
uv run python -m http.server 8001 --directory docs/_build/htmlFrom my perspective this is now feature complete, meaning it has all of the distribution that I use somewhat regularly. If you want to add a new distribution, get in touch. Otherwise, I'll just be fixing bugs and typos/ommisions in the documentaion.