Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized Lambda distribution implementation: distributions.genlambda #119

Merged
merged 26 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b626176
reparemetrized GLD into standard form, like Wakeby
jorenham Dec 10, 2023
796f5a0
typo fixes
jorenham Dec 10, 2023
bf955e0
switch to `pymdownx.blocks.admonition`
jorenham Dec 10, 2023
ad4eb11
abbreviation tooltips
jorenham Dec 10, 2023
4338267
minor fixes
jorenham Dec 10, 2023
e0fbf15
added references
jorenham Dec 10, 2023
ee977c0
fixed domain of GLD
jorenham Dec 10, 2023
1d3a097
changed the GLD phi param for tukey-lambda compat
jorenham Dec 10, 2023
1934f63
Added `theoretical.entropy_from_qdf`
jorenham Dec 11, 2023
c70d469
initial GLD implementation as `distributions.genlambda`
jorenham Dec 11, 2023
e3b815d
refer to `distributions.genlambda` from GLD
jorenham Dec 11, 2023
96afd6a
grammar fix
jorenham Dec 11, 2023
dcce393
cleaner types in `entropy_from_qdf` docs
jorenham Dec 11, 2023
6b8c958
loosened GLD L-moment contraints
jorenham Dec 11, 2023
3b3c9b4
GLD L-moment equation fix
jorenham Dec 11, 2023
4c427c1
explicit GLD L-moment limiting cases
jorenham Dec 11, 2023
8660324
Cleaner harmonic numbers in the GLD L-moments
jorenham Dec 11, 2023
1ce4e22
rewrote GLD L-moments using beta functions
jorenham Dec 11, 2023
0698fd8
consistend GLD L-moment sign usage
jorenham Dec 12, 2023
c6d7140
`genlambda` tests and related fixes
jorenham Dec 12, 2023
4feb1ff
GLD special cases
jorenham Dec 12, 2023
422edf0
Some PDF plots for the GLD
jorenham Dec 13, 2023
5db0751
css cleanup
jorenham Dec 13, 2023
2664222
explicit tables mkdocs markdown extension
jorenham Dec 13, 2023
3bb0a35
list GLD"s first 4 L-moments
jorenham Dec 13, 2023
4b370aa
Listing of first 4 GLD L-/LL-/LH-/TL-moments
jorenham Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
522 changes: 405 additions & 117 deletions docs/distributions.md

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions docs/gallery/genlambda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# pyright: reportUnknownMemberType=false
from pathlib import Path

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

from lmo.distributions import genlambda

GALLERY_PATH = Path(__file__).resolve().parent
TEX_LABEL_TEMPLATE = r'$\beta = {},\ \delta = {}$'

X_MIN, X_MAX = -2, 2

if __name__ == '__main__':
plt.style.use([
'dark_background',
'seaborn-v0_8-poster',
GALLERY_PATH.parent / 'styles' / 'gallery.mplstyle',
])

plt.figure(figsize=(16, 9), dpi=240)
palette = mpl.color_sequences['Paired']

b_denom = 2
f = 0

y_max = 0
for b_numer, linestyle in zip([1, -1], ['-', '--']):
for i, d in enumerate(range(-2, 3)):
b = b_numer / b_denom
xa, xb = genlambda.support(b, d, f)

x = np.linspace(max(X_MIN, xa), min(X_MAX, xb), 1000)
y = genlambda.pdf(x, b, d, f)
y_max = max(y.max(), y_max)

plt.plot(
x,
y,
linestyle,
label=TEX_LABEL_TEMPLATE.format(
f'{b_numer:+d}/{b_denom}',
f'{d:+d}',
).replace('+', r'\quad\;'), # (\vphantom requires amsmath)
alpha=0.8,
color=palette[i]
)

plt.legend()
plt.ylabel('$f(X)$', rotation=0)
plt.xlabel('$X$')
plt.xlim(X_MIN, X_MAX)
plt.ylim(0, 1.01 * y_max)
plt.title(r'PDF of $X \sim \mathrm{GLD}(\beta, \delta, \phi = 0)$')
plt.tight_layout()
plt.savefig(
GALLERY_PATH / 'genlambda.svg',
transparent=True,
format='svg',
bbox_inches='tight'
)

Loading