Pragmastat: Pragmatic Statistical Toolkit
Project description
Python
Install from PyPI:
pip install pragmastat==10.0.4
Source code: https://github.com/AndreyAkinshin/pragmastat/tree/v10.0.4/py
Pragmastat on PyPI: https://pypi.org/project/pragmastat/
Demo
from pragmastat import (
Rng,
center,
spread,
shift,
ratio,
disparity,
center_bounds,
shift_bounds,
ratio_bounds,
spread_bounds,
disparity_bounds,
)
from pragmastat.distributions import Additive, Exp, Multiplic, Power, Uniform
def main():
# --- One-Sample ---
x = list(range(1, 21))
print(center(x)) # 10.5
bounds = center_bounds(x, 0.05)
print(
f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
) # Bounds(lower=7.5, upper=13.5)
print(spread(x)) # 6.0
bounds = spread_bounds(x, 0.05, seed="demo")
print(
f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
) # Bounds(lower=2.0, upper=10.0)
# --- Two-Sample ---
x = list(range(1, 31))
y = list(range(21, 51))
print(shift(x, y)) # -20.0
bounds = shift_bounds(x, y, 0.05)
print(
f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
) # Bounds(lower=-25.0, upper=-15.0)
print(ratio(x, y)) # 0.43669798282695127
bounds = ratio_bounds(x, y, 0.05)
print(
f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
) # Bounds(lower=0.31250000000000006, upper=0.5599999999999999)
print(disparity(x, y)) # -2.2222222222222223
bounds = disparity_bounds(x, y, 0.05, seed="demo")
print(
f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
) # Bounds(lower=-13.0, upper=-0.8235294117647058)
# --- Randomization ---
rng = Rng("demo-uniform")
print(rng.uniform_float()) # 0.2640554428629759
print(rng.uniform_float()) # 0.9348534835582796
rng = Rng("demo-uniform-int")
print(rng.uniform_int(0, 100)) # 41
rng = Rng("demo-sample")
print(rng.sample([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3)) # [3, 8, 9]
rng = Rng("demo-resample")
print(rng.resample([1, 2, 3, 4, 5], 7)) # [3, 1, 3, 2, 4, 1, 2]
rng = Rng("demo-shuffle")
print(rng.shuffle([1, 2, 3, 4, 5])) # [4, 2, 3, 5, 1]
# --- Distributions ---
rng = Rng("demo-dist-additive")
print(Additive(0, 1).sample(rng)) # 0.17410448679568188
rng = Rng("demo-dist-multiplic")
print(Multiplic(0, 1).sample(rng)) # 1.1273244602673853
rng = Rng("demo-dist-exp")
print(Exp(1).sample(rng)) # 0.6589065267276553
rng = Rng("demo-dist-power")
print(Power(1, 2).sample(rng)) # 1.023677535537084
rng = Rng("demo-dist-uniform")
print(Uniform(0, 10).sample(rng)) # 6.54043657816832
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pragmastat-10.0.4.tar.gz
(37.1 kB
view details)
File details
Details for the file pragmastat-10.0.4.tar.gz.
File metadata
- Download URL: pragmastat-10.0.4.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
649e5e00c95fda42c664cece0bcb994223acaa2fd691b347d96a617316868c33
|
|
| MD5 |
678380c36627b1641101fe148d49fdda
|
|
| BLAKE2b-256 |
2a9192340c8f63d4425f4bb28bd385900bd5507b570094ef200c62820dd3c982
|
Provenance
The following attestation bundles were made for pragmastat-10.0.4.tar.gz:
Publisher:
publish.yml on AndreyAkinshin/pragmastat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pragmastat-10.0.4.tar.gz -
Subject digest:
649e5e00c95fda42c664cece0bcb994223acaa2fd691b347d96a617316868c33 - Sigstore transparency entry: 974733914
- Sigstore integration time:
-
Permalink:
AndreyAkinshin/pragmastat@bb71a3149416909bb5ad23e0229713c8d7be7ff1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AndreyAkinshin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb71a3149416909bb5ad23e0229713c8d7be7ff1 -
Trigger Event:
workflow_dispatch
-
Statement type: