{"id":16346240,"url":"https://github.com/jorenham/lmo","last_synced_at":"2025-03-16T15:31:03.262Z","repository":{"id":159026923,"uuid":"634264205","full_name":"jorenham/Lmo","owner":"jorenham","description":"Trimmed L-moments and L-comoments for robust statistics.","archived":false,"fork":false,"pushed_at":"2024-10-24T21:36:42.000Z","size":7057,"stargazers_count":5,"open_issues_count":18,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-26T09:10:26.353Z","etag":null,"topics":["fitting-distribution","l-comoments","l-moments","lmo","multivariate-statistics","numpy","probability-statistics","python","robust-optimization","robust-statistics","statistics","tl-moments"],"latest_commit_sha":null,"homepage":"https://jorenham.github.io/Lmo/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jorenham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jorenham"}},"created_at":"2023-04-29T15:14:22.000Z","updated_at":"2024-10-24T21:33:23.000Z","dependencies_parsed_at":"2023-10-16T13:50:37.452Z","dependency_job_id":"872d0ecf-b36b-47b7-87dc-153fade33608","html_url":"https://github.com/jorenham/Lmo","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorenham%2FLmo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorenham%2FLmo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorenham%2FLmo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorenham%2FLmo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jorenham","download_url":"https://codeload.github.com/jorenham/Lmo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665204,"owners_count":16860194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fitting-distribution","l-comoments","l-moments","lmo","multivariate-statistics","numpy","probability-statistics","python","robust-optimization","robust-statistics","statistics","tl-moments"],"created_at":"2024-10-11T00:34:51.031Z","updated_at":"2025-03-16T15:31:03.251Z","avatar_url":"https://github.com/jorenham.png","language":"Python","readme":"\u003c!--overview-start--\u003e\n\n# Lmo - Trimmed L-moments and L-comoments\n\n[![Lmo - PyPI][IMG-PYPI]][PYPI]\n[![Lmo - Python versions][IMG-PY]][REPO]\n[![Lmo - SPEC 0][IMG-SPEC0]][SPEC0]\n[![Lmo - BSD License][IMG-BSD]][BSD]\n[![Lmo - CI][IMG-CI]][CI]\n[![Lmo - ruff][IMG-RUFF]][RUFF]\n[![Lmo - bassedpyright][IMG-BPR]][BPR]\n![PyPI - Types](https://img.shields.io/pypi/types/Lmo)\n\nUnlike the legacy\n[product-moments](https://wikipedia.org/wiki/Moment_(mathematics)), the\n[*L-moments*](https://wikipedia.org/wiki/L-moment) **uniquely describe** a\nprobability distribution, and are more robust and efficient.\n\nThe \"L\" stands for Linear; it is a linear combination of order statistics.\nSo Lmo is as fast as sorting your samples (in terms of time-complexity).\n\n## Key Features\n\n- Calculates trimmed L-moments and L-*co*moments, from samples or any\n  `scipy.stats` distribution.\n- Full support for trimmed L-moment (TL-moments), e.g.\n  `lmo.l_moment(..., trim=(1/137, 3.1416))`.\n- Generalized Method of L-moments: robust distribution fitting that beats MLE.\n- Fast estimation of L-*co*moment matrices from your multidimensional data\n  or multivariate distribution.\n- Goodness-of-fit test, using L-moment or L-moment ratio's.\n- Exact (co)variance structure of the sample- and population L-moments.\n- Theoretical \u0026 empirical influence functions of L-moments \u0026 L-ratio's.\n- Complete [docs][DOCS], including detailed API\nreference with usage examples and with mathematical $\\TeX$ definitions.\n- Clean Pythonic syntax for ease of use.\n- Vectorized functions for very fast fitting.\n- Fully typed, tested, and tickled.\n- Optional Pandas integration.\n\n## Quick example\n\nEven if your data is pathological like\n[Cauchy](https://wikipedia.org/wiki/Cauchy_distribution), and the L-moments\nare not defined, the trimmed L-moments (TL-moments) can be used instead.\n\nLet's calculate the first two TL-moments (the TL-location and the TL-scale) of a small\namount of samples drawn from the standard Cauchy distribution:\n\n```pycon\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e import lmo\n\u003e\u003e\u003e rng = np.random.default_rng(1980)\n\u003e\u003e\u003e data = rng.standard_cauchy(96)\n\u003e\u003e\u003e lmo.l_moment(data, [1, 2], trim=1)\narray([-0.17937038,  0.68287665])\n```\n\nCompared with the theoretical standard Cauchy TL-moments, that pretty close!\n\n```pycon\n\u003e\u003e\u003e from scipy.stats import cauchy\n\u003e\u003e\u003e cauchy.l_moment([1, 2], trim=1)\narray([0.        , 0.69782723])\n```\n\nNow let's try this again using the first two conventional moments, i.e. the mean\nand the standard deviation:\n\n```pycon\n\u003e\u003e\u003e from scipy.stats import moment\n\u003e\u003e\u003e np.r_[data.mean(), data.std()]\narray([-1.7113441 , 19.57350731])\n```\n\nSo even though the `data` was drawn from the *standard* Cauchy distribution, we can\nimmediately see that this look standard at all.\n\nThe reason is that the Cauchy distribution doesn't have a mean or standard\ndeviation:\n\n```pycon\n\u003e\u003e\u003e np.r_[cauchy.mean(), cauchy.std()]\narray([nan, nan])\n```\n\n---\n\nSee the [documentation][DOCS] for more examples and the API reference.\n\n## Installation\n\nLmo is available on [PyPI][PYPI], and can be installed\nwith:\n\n```shell\npip install lmo\n```\n\n## Roadmap\n\n- Automatic trim-length selection.\n- Plotting utilities (deps optional), e.g. for L-moment ratio diagrams.\n\n### Dependencies\n\nThese are automatically installed by your package manager when installing Lmo.\n\n|                | version    |\n| -------------: | ---------- |\n| [`python`][PY] | `\u003e=3.11`   |\n|  [`numpy`][NP] | `\u003e=1.25.2` |\n|  [`scipy`][SP] | `\u003e=1.11.4` |\n\nAdditionally, Lmo supports the following optional packages:\n\n|                | version | `pip install _` |\n| -------------: | ------- | --------------- |\n| [`pandas`][PD] | `\u003e=2.0` | `Lmo[pandas]`   |\n\nSee [SPEC 0][SPEC0] for more information.\n\n## Foundational Literature\n\n- [*J.R.M. Hosking* (1990) \u0026ndash; L-moments: Analysis and Estimation of Distributions using Linear Combinations of Order Statistics](https://doi.org/10.1111/j.2517-6161.1990.tb01775.x)\n- [*E.A.H. Elamir \u0026 A.H. Seheult* (2003) \u0026ndash; Trimmed L-moments](https://doi.org/10.1016/S0167-9473(02)00250-5)\n- [*J.R.M. Hosking* (2007) \u0026ndash; Some theory and practical uses of trimmed L-moments](https://doi.org/10.1016/j.jspi.2006.12.002)\n- [*R. Serﬂing \u0026 P. Xiao* (2007) \u0026ndash; A contribution to multivariate L-moments: L-comoment matrices](https://doi.org/10.1016/j.jmva.2007.01.008)\n\n[IMG-PYPI]: https://img.shields.io/pypi/v/Lmo\n[IMG-PY]: https://img.shields.io/pypi/pyversions/Lmo\n[IMG-SPEC0]: https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811\u0026color=%235CA038\n[IMG-BSD]: https://img.shields.io/github/license/jorenham/Lmo\n[IMG-CI]: https://img.shields.io/github/actions/workflow/status/jorenham/Lmo/ci.yml?branch=master\n[IMG-RUFF]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n[IMG-BPR]: https://img.shields.io/badge/basedpyright-checked-42b983\n\n[PYPI]: https://pypi.org/project/Lmo/\n[REPO]: https://github.com/jorenham/Lmo\n[DOCS]: https://jorenham.github.io/Lmo/\n[BSD]: https://github.com/jorenham/Lmo/blob/master/LICENSE\n[CI]: https://github.com/jorenham/Lmo/actions/workflows/ci.yml?query=branch%3Amaster\n\n[RUFF]: https://github.com/astral-sh/ruff\n[BPR]: https://github.com/detachhead/basedpyright/\n[PY]: https://github.com/python/cpython\n[NP]: https://github.com/numpy/numpy\n[SP]: https://github.com/scipy/scipy\n[PD]: https://github.com/pandas-dev/pandas\n[SPEC0]: https://scientific-python.org/specs/spec-0000/\n\n\u003c!--overview-end--\u003e\n","funding_links":["https://github.com/sponsors/jorenham"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorenham%2Flmo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorenham%2Flmo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorenham%2Flmo/lists"}