Skip to main content

L-Moments for robust statistics.

Project description

jorenham/lmo

Lmo - Trimmed L-moments and L-comoments

GitHub Workflow Status (with branch) PyPI versions license


Is your tail too heavy? 
Can't find a moment? 
Are the swans black? 
The distribution pathological?

... then look no further: Lmo's got you covered!

Uniform or multi-dimensional, Lmo can summarize it all with one quick glance!

Unlike the legacy moments, L-moments uniquely describe a probability distribution. The "L" stands for Linear; it is a linear combination of order statistics. So Lmo is as fast as sorting your samples (in terms of time-complexity).

Even if your data is pathological like Cauchy, and the L-moments are not defined, the trimmed L-moments (TL-moments) can be used instead:

>>> import numpy as np
>>> import lmo
>>> rng = np.random.default_rng(1980)
>>> x = rng.standard_cauchy(96)  # pickle me, Lmo
>>> x.mean(), x.std()  # don't try this at home
(-1.7113440959133905, 19.573507308373326)
>>> lmo.l_loc(x, trim=(1, 1)), lmo.l_scale(x, (1, 1)) 
(-0.17937038148581977, 0.6828766469913776)

For reference; the theoretical TL-location and TL-scale of the standard Cauchy distribution are $\lambda^{(1, 1)}_{1} = 0$ and $\lambda^{(1, 1)}_2 \approx 0.7$ (Elamir & Seheult, 2003).

Key Features:

  • Calculates trimmed L-moments and L-comoments, from data and distributions.
  • Exact non-parametric variance structure of the sample estimates.
  • Coming soon: Robust distribution fitting; the method of L-moments.
  • Complete docs, including overly complex $\TeX$ spaghetti equations.
  • Clean Pythonic syntax for ease of use.
  • Vectorized functions for very fast fitting.
  • Fully typed, tested, and tickled.

See the documentation for usage examples and code reference.

Installation

Lmo is on PyPI, so you can do something like:

pip install lmo

Dependencies

  • python >= 3.10
  • numpy >= 1.22
  • scipy >= 1.9

Foundational Literature

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lmo-0.8.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

lmo-0.8.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file lmo-0.8.0.tar.gz.

File metadata

  • Download URL: lmo-0.8.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.2 Linux/6.2.6-76060206-generic

File hashes

Hashes for lmo-0.8.0.tar.gz
Algorithm Hash digest
SHA256 d318e347bd80f6a0540250d028a4ff469c3f0205fb7afd21db554ecf572e1be3
MD5 7ffae2e23a516b557ddd835e65833fff
BLAKE2b-256 d6e25bc8d7628be56a90ebc787a2a1c6abcb70cfe44c72d3d9994f37605a3ee4

See more details on using hashes here.

File details

Details for the file lmo-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: lmo-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.2 Linux/6.2.6-76060206-generic

File hashes

Hashes for lmo-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 241771888060bc715c4aa5204490b1690410b7b40a5fa7171751839603f8484f
MD5 95468834cfab4fdb331c1b5ddd138cf3
BLAKE2b-256 e65d27f4c894eaa4d8d48758eb001cca8d544a4a35e8aec2770f0f32b412abf4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page