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.1.tar.gz (6.6 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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: statilib-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 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.1.tar.gz
Algorithm Hash digest
SHA256 5f3cbc10bffe537d3c02600bb305162e671b8ad2e15a040f3e287755c0019ef1
MD5 19ac68b2bd9beec1116a5d7234a989c0
BLAKE2b-256 21d19177280b6454e61498d5a39153d17adc53873ffc9f4b5e6ca9287991342a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: statilib-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ea38cb4b003177e66540ca55d212e640e9f8fddbb8f92b0adbf37d1252e1699
MD5 87926dec5db463bc63bf3d64cf488662
BLAKE2b-256 2289caa511ba6db7f838c901112ecefc07c2414f73f5988f84bb564973baed95

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