Skip to main content

About

applied_stats is a Python library that implements various statistical distributions and methods in Python. The continuous_distributions module supports plotting and calculating probabilities for normal, chi-squared, t, and F distributions, and the mle module can calculate various maximum likelihood estimators based on particular distributions. I plan to continue development of this to add new functionality and modules in the future.

The project was inspired while I took MAT 561 (Probability) and MAT 562 (Mathematical Statistics) at the University of Louisville. The goal of this is to provide simple tools to work with applied statistics, while also aiding my own understanding by applying theoretical techniques learned during class.

Please feel free to submit PRs or Issues if you'd like!

Installation

Run the following to install the applied-stats:

$ pip install applied-stats

This has been tested on Windows 10 and Ubuntu 21.04; will test on macOS soon.

Usage

Follow these examples to start plotting and calculating probabilities. Various examples, including the ones below, can also be found in the Demonstration Jupyter Notebook

Generate some plots and calculate some probabilities:

>>> from applied_stats import continuous_distributions
>>> a = Norm_rv(0,1)
>>> a.plot_pdf()
>>> a.probability_calc()

Note: pypi has some difficulty rendering the below plot images, they can be viewed on GitHub. link

>>> q = ChiSq_rv(4,crit_value=7)
>>> q.plot_pdf(cv_probability=True)
>>> q.probability_calc()

link

Calculate a two-tailed Chi-Sq distribution and plot:

>>> z = st.ChiSq_rv(3)
>>> z.plot_pdf(left_cv=1, right_cv=7, cv_probability=True, two_tail=True)
>>> z.probability_calc()

link

Calculate the numeric MLE of several common distributions:

>>> from stats_tools import mle 
>>> a = [1,3,2,5,6,7,2,3,4,5]
>>> mle.binomial(10, a)
>>> 0.38

>>> b = [1.2,4.3,2.3,6.8,2.4,3.6]
>>> mle.exponential(b) 
>>> 3.4333333333333336

A basic hypothesis test

>>> data = ['R', 'B', 'R', 'B', 'R', 'B', 'R', 'B', 'R', 'B']
>>> a = gen_test(data, 'H0 is that there are 5 red marbles in a bag')
>>> a.run_test(n=4, 
           counter='R', 
           accept_left=3, 
           accept_right=4)

>>> 'Do not reject H0. Count is 3'

Tests

Run the tests from the command line with python test.py -v

Metadata

Release files for applied-stats 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for applied-stats 1.0.0
File Size Uploaded
applied_stats-1.0.0.tar.gz 96.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for applied-stats 1.0.0
File Interpreter ABI Platform
applied_stats-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.2 kB

Release files / applied_stats-1.0.0.tar.gz

Download URL applied_stats-1.0.0.tar.gz
Size 96.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc64461c15eacb750772134ba70bf28f7fc2a25b147a4e67cb15a1af86d48018
BLAKE2b-256 checksum
How to use checksums
c1e968b6672f2328d76bf67f394215aff672a64f9f4709bcd404ed00e5945d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release files / applied_stats-1.0.0-py3-none-any.whl

Download URL applied_stats-1.0.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4a0d2fdf84b47970dda8d1dc17d75a745c03a7e82f54527d01eb7874c80cf01
BLAKE2b-256 checksum
How to use checksums
d8ede0e5704e5305d3b67256df26c5861e1aeb5e8a79e23c732b828defe031fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page