lmo

Trimmed L-moments and L-comoments for robust statistics.

https://github.com/jorenham/lmo

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.9%) to scientific vocabulary

Keywords

fitting-distribution l-comoments l-moments lmo multivariate-statistics numpy probability-statistics python robust-optimization robust-statistics statistics tl-moments

Keywords from Contributors

energy-system-model mesh interpretability parallel optimizer yolov5s pipeline-testing datacleaner data-profilers particles
Last synced: 6 months ago · JSON representation ·

Repository

Trimmed L-moments and L-comoments for robust statistics.

Basic Info
Statistics
  • Stars: 8
  • Watchers: 2
  • Forks: 1
  • Open Issues: 25
  • Releases: 27
Topics
fitting-distribution l-comoments l-moments lmo multivariate-statistics numpy probability-statistics python robust-optimization robust-statistics statistics tl-moments
Created almost 3 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing Funding License Citation Security

README.md

Lmo - Trimmed L-moments and L-comoments

Lmo - PyPI Lmo - Python versions Lmo - SPEC 0 Lmo - BSD License Lmo - CI Lmo - ruff Lmo - bassedpyright PyPI - Types

Unlike the legacy product-moments, the L-moments uniquely describe a probability distribution, and are more robust and efficient.

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).

Key Features

  • Calculates trimmed L-moments and L-comoments, from samples or any scipy.stats distribution.
  • Full support for trimmed L-moment (TL-moments), e.g. lmo.l_moment(..., trim=(1/137, 3.1416)).
  • Generalized Method of L-moments: robust distribution fitting that beats MLE.
  • Fast estimation of L-comoment matrices from your multidimensional data or multivariate distribution.
  • Goodness-of-fit test, using L-moment or L-moment ratio's.
  • Exact (co)variance structure of the sample- and population L-moments.
  • Theoretical & empirical influence functions of L-moments & L-ratio's.
  • Complete docs, including detailed API reference with usage examples and with mathematical $\TeX$ definitions.
  • Clean Pythonic syntax for ease of use.
  • Vectorized functions for very fast fitting.
  • Fully typed, tested, and tickled.
  • Optional Pandas integration.

Quick example

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.

Let's calculate the first two TL-moments (the TL-location and the TL-scale) of a small amount of samples drawn from the standard Cauchy distribution:

```pycon

import numpy as np import lmo rng = np.random.defaultrng(1980) data = rng.standardcauchy(96) lmo.l_moment(data, [1, 2], trim=1) array([-0.17937038, 0.68287665]) ```

Compared with the theoretical standard Cauchy TL-moments, that pretty close!

```pycon

from scipy.stats import cauchy cauchy.l_moment([1, 2], trim=1) array([0. , 0.69782723]) ```

Now let's try this again using the first two conventional moments, i.e. the mean and the standard deviation:

```pycon

from scipy.stats import moment np.r_[data.mean(), data.std()] array([-1.7113441 , 19.57350731]) ```

So even though the data was drawn from the standard Cauchy distribution, we can immediately see that this look standard at all.

The reason is that the Cauchy distribution doesn't have a mean or standard deviation:

```pycon

np.r_[cauchy.mean(), cauchy.std()] array([nan, nan]) ```


See the documentation for more examples and the API reference.

Installation

Lmo is available on PyPI, and can be installed with:

shell pip install lmo

Roadmap

  • Automatic trim-length selection.
  • Plotting utilities (deps optional), e.g. for L-moment ratio diagrams.

Dependencies

These are automatically installed by your package manager when installing Lmo.

| | version | | -------------: | ---------- | | python | >=3.11 | | numpy | >=1.25.2 | | scipy | >=1.11.4 |

Additionally, Lmo supports the following optional packages:

| | version | pip install _ | | -------------: | ------- | --------------- | | pandas | >=2.0 | Lmo[pandas] |

See SPEC 0 for more information.

Foundational Literature

Owner

  • Name: Joren Hammudoglu
  • Login: jorenham
  • Kind: user
  • Location: Delft, the Netherlands

NumPy maintainer, author of scipy-stubs, numtype, optype, and Lmo.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Lmo
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Joren
    family-names: Hammudoglu
    orcid: 'https://orcid.org/0009-0003-7341-5928'
repository-code: 'https://github.com/jorenham/Lmo/'
url: 'https://jorenham.github.io/Lmo/'
abstract: Trimmed L-moments and L-comoments for robust statistics.
license: BSD-3-Clause

GitHub Events

Total
  • Issues event: 10
  • Watch event: 2
  • Delete event: 50
  • Issue comment event: 9
  • Push event: 77
  • Pull request event: 101
  • Create event: 48
Last Year
  • Issues event: 10
  • Watch event: 2
  • Delete event: 50
  • Issue comment event: 9
  • Push event: 77
  • Pull request event: 101
  • Create event: 48

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,059
  • Total Committers: 4
  • Avg Commits per committer: 264.75
  • Development Distribution Score (DDS): 0.071
Past Year
  • Commits: 221
  • Committers: 3
  • Avg Commits per committer: 73.667
  • Development Distribution Score (DDS): 0.127
Top Committers
Name Email Commits
jorenham j****u@g****m 984
dependabot[bot] 4****] 52
pre-commit-ci[bot] 6****] 15
Rick van Hattem W****h@w****h 8
Committer Domains (Top 20 + Academic)
wol.ph: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 56
  • Total pull requests: 349
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 3 days
  • Total issue authors: 2
  • Total pull request authors: 4
  • Average comments per issue: 0.3
  • Average comments per pull request: 0.4
  • Merged pull requests: 224
  • Bot issues: 0
  • Bot pull requests: 198
Past Year
  • Issues: 12
  • Pull requests: 94
  • Average time to close issues: 1 day
  • Average time to close pull requests: about 17 hours
  • Issue authors: 2
  • Pull request authors: 3
  • Average comments per issue: 0.58
  • Average comments per pull request: 0.05
  • Merged pull requests: 78
  • Bot issues: 0
  • Bot pull requests: 50
Top Authors
Issue Authors
  • jorenham (54)
  • muhdnuru (1)
Pull Request Authors
  • dependabot[bot] (265)
  • jorenham (221)
  • pre-commit-ci[bot] (50)
Top Labels
Issue Labels
enhancement (33) contrib (11) easy (8) bug (6) low priority (6) documentation (5) performance (5) typing (2) dependencies (2) research required (2) packaging (1) question (1)
Pull Request Labels
dependencies (267) python (115) github actions (23) static typing (10) documentation (9) enhancement (3) performance (3) breaking change (3) typing (2) contrib (2) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 187 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 30
  • Total maintainers: 1
pypi.org: lmo

L-Moments for robust statistics & inference.

  • Versions: 30
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 187 Last month
Rankings
Dependent packages count: 7.2%
Average: 20.3%
Dependent repos count: 33.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
poetry.lock pypi
  • appnope 0.1.3
  • asttokens 2.4.0
  • attrs 23.1.0
  • babel 2.13.0
  • backcall 0.2.0
  • bracex 2.4
  • certifi 2023.7.22
  • cffi 1.16.0
  • charset-normalizer 3.3.0
  • click 8.1.7
  • codespell 2.2.6
  • colorama 0.4.6
  • comm 0.1.4
  • contourpy 1.1.1
  • cycler 0.12.1
  • debugpy 1.8.0
  • decorator 5.1.1
  • exceptiongroup 1.1.3
  • executing 2.0.0
  • fonttools 4.43.1
  • ghp-import 2.1.0
  • griffe 0.36.4
  • hypothesis 6.87.3
  • idna 3.4
  • iniconfig 2.0.0
  • ipykernel 6.25.2
  • ipython 8.16.1
  • jedi 0.19.1
  • jinja2 3.1.2
  • jupyter-client 8.3.1
  • jupyter-core 5.3.2
  • kiwisolver 1.4.5
  • line-profiler 4.1.1
  • markdown 3.5
  • markupsafe 2.1.3
  • matplotlib 3.8.0
  • matplotlib-inline 0.1.6
  • mergedeep 1.3.4
  • mkdocs 1.5.3
  • mkdocs-autorefs 0.5.0
  • mkdocs-include-markdown-plugin 6.0.1
  • mkdocs-material 9.4.4
  • mkdocs-material-extensions 1.2
  • mkdocstrings 0.23.0
  • mkdocstrings-python 1.7.2
  • nest-asyncio 1.5.8
  • nodeenv 1.8.0
  • numpy 1.26.0
  • packaging 23.2
  • paginate 0.5.6
  • parso 0.8.3
  • pathspec 0.11.2
  • pexpect 4.8.0
  • pickleshare 0.7.5
  • pillow 10.0.1
  • platformdirs 3.11.0
  • pluggy 1.3.0
  • prompt-toolkit 3.0.39
  • psutil 5.9.5
  • ptyprocess 0.7.0
  • pure-eval 0.2.2
  • pycparser 2.21
  • pygments 2.16.1
  • pymdown-extensions 10.3
  • pyparsing 3.1.1
  • pyright 1.1.330.post0
  • pytest 7.4.2
  • python-dateutil 2.8.2
  • pywin32 306
  • pyyaml 6.0.1
  • pyyaml-env-tag 0.1
  • pyzmq 25.1.1
  • regex 2023.10.3
  • requests 2.31.0
  • ruff 0.0.292
  • scipy 1.11.3
  • setuptools 68.2.2
  • setuptools-scm 8.0.4
  • six 1.16.0
  • sortedcontainers 2.4.0
  • stack-data 0.6.3
  • tomli 2.0.1
  • tornado 6.3.3
  • traitlets 5.11.2
  • typing-extensions 4.8.0
  • urllib3 2.0.6
  • watchdog 3.0.0
  • wcmatch 8.5
  • wcwidth 0.2.8
pyproject.toml pypi
  • numpy ^1.22.4
  • python >=3.10,<3.13
  • scipy ^1.9
  • typing_extensions ^4.1