Skip to main content

A simple statistics library

Project description

statlib

A small statistics library providing common descriptive and inferential statistics functions, grouped-data helpers, and basic probability utilities. The package appears authored by Abdulrahman F. Alosaimi.

Project layout

  • statlib/formula.py - main implementation of statistical functions
  • statlib/unit_tests.py - unit tests for several core functions

Usage

Import the functions you need from statlib:

from statlib import formula

print(formula.mean([1,2,3,4,5], 5))

Key functions (summary)

The formula.py module implements many functions. Highlights:

  • Data description

    • mean(x, n) — sample mean
    • medine(data) — median (handles even/odd lengths)
    • mid_range(highest, lowest)
    • mid_point(h_limit, l_limit)
    • mod(data) — mode (returns list with mode and its frequency when applicable)
  • Grouped data helpers

    • mean_for_grouped_data(x, f, n) — mean for grouped data using class midpoints
    • medine_for_grouped_data(f, cumulative_f) — median for grouped data (expects class rows [lower, upper, freq, cumulative_freq])
  • Variation & dispersion

    • rnge(high, low) — range
    • pop_variance, standard_deviation_pop
    • sample_variance, standard_deviation_sample
    • variance_grouped
    • coff_of_variation_sample, coff_of_variation_pop
  • Percentiles & z-scores

    • percent, relative_frequncy, coumulative_frequncy_percentile, percentile, percentile_to_value
    • z_scores_pop, z_scores_sample
  • Outliers & quartiles

    • quar_of(data) — returns [Q1, Q2, Q3]
    • outlier(data) — returns [lower_limit, upper_limit, list_of_outliers]
  • Correlation & regression

    • correlation_coefficient(data, n)
    • regression_line(data, n, x) — predicts y for given x using linear regression
  • Probability & counting

    • prob, emprical_prob, event_comp, Bayes_prob, independ_intersect_prob, depend_intersect_prob
    • permu_count, comb_count

Contributing

Feel free to open issues or PRs. Small improvements I'd prioritize:

  • Fix arithmetic bugs and replace =+ with += where needed
  • Add more unit tests and type hints
  • Standardize naming and export a cleaner public API

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

statilib-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

statilib-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file statilib-0.1.0.tar.gz.

File metadata

  • Download URL: statilib-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for statilib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e0c85038dbc809fbf7486cc17973ac68cd41eb114e2f26b16193fa84293b78f
MD5 55b83aa09a7e07f65b88d70bc2d2fb08
BLAKE2b-256 f467cfc0255254e3660267ba7a0883401cc751162264d88f2dfdb0c11d8d06e2

See more details on using hashes here.

File details

Details for the file statilib-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: statilib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for statilib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d131a78706851a9825722c5dc398f0288ed86ac8f5dd06bcd42d9cce993559bd
MD5 2fa25beed12669362c8541552eb42414
BLAKE2b-256 b7369e286b86c62d3e77ec13fc512510ac2c6df66ea7c72c56d790acf34783af

See more details on using hashes here.

Supported by

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