Skip to main content

This package provides function for calculating pnorm, qnorm, pexp and qexp.

Project description

mathdistops

This package provides statistical functions for normal and exponential distributions, including pnorm, qnorm, pexp, and qexp. Each function not only performs the respective statistical calculation but also generates the corresponding plot of the distribution, offering both numerical results and visual outputs.

ci-cd codecov Python 3.9.0 Documentation Status codesize version License: MIT

Contributors

Our team listed in alphabetical order:

  • Katherine Chen
  • Kun Ya
  • Oak Chong
  • Sandra Gross

Installation

This package uses Poetry for dependency management and packaging. It is not yet available for installation via pip. To install and use this package, please follow these steps:

  1. Install Poetry and Conda: If you don't have Poetry or Conda installed, install them by following the official installation guide for Poetry and Conda.

  2. Clone the Repository: Clone this repository to your local machine.

    git clone https://github.com/UBC-MDS/mathdistops.git
    cd mathdistops
    
  3. Install the virtual environment:

     conda env create -f environment.yaml
    
  4. Activate the installed environment:

     conda activate mathdistops
    
  5. Install the Package with Poetry: Use Poetry to install the package and its dependencies.

    poetry install
    

Usage

Using this package

To use this package, you can import and call its functions in your Python scripts. Here's an example:

# Run this on jupyter notebook to show the altair object
from mathdistops import pnorm

df, fig = pnorm(1, mean=0, std_dev=1)
print(df)
fig

Below is a sample usage on Jupyter Notebook.

Running unit tests

To run unit tests for this package, execute the following in the project root directory:

    $ poetry run pytest

To get a the code coverage reporting, run this command:

    $ poetry run pytest --cov=mathdistops
    $ poetry run pytest --cov-branch --cov=mathdistops

Functions

Description

  • pexp(q, rate=1, graph=True): Represents the Cumulative Distribution Function (CDF) of the exponential distribution characterized by a given parameter rate. The function calculates the cumulative probability for a given quantile q and plots the corresponding probability distribution (PDF) and the CDF.

  • qexp(p, rate=1, graph=True): Quantile Function of an exponential distribution, characterized by a given rate parameter rate. The function calculates the quantile corresponding to given cumulative probability p in an exponential distribution. Optionally, it can also generate and return a visualization of the PDF and the CDF.

  • pnorm(q, mean = 0, std_dev =1, graph = True): Cumulative Distribution Function of the normal distribution with specified mean and standard deviation. It will return the cumulative probability up to the given value q. Optionally, it can generate and return a visualization of the distributions, the PDF and the CDF.

  • qnorm(p, mean=0, std_dev=1, graph=True): Calculates the quantile (Inverse Cumulative Distribution Function) corresponding to a specified cumulative probability p of the normal distribution with specified mean and standard deviation. The function can additionally create and provide a graphical representation of the PDF and the CDF.

Documentation

A comprehensive guide and tutorial on utilizing these functions are available on ReadTheDocs. To access it, click the "docs" button located at the top of the README.

Python Ecosystem Integration

While python has relevant functions for normal and exponential distribution in the scipy.stats package, this package offer an in-built additional functionality of returning the plot to help with visualization and understanding the problem.

Related Packages:

  • scipy.stats.norm is an official scipy package to represent a normal continuous random variable.
  • scipy.stats.expon is an official scipy package to represent an exponential continuous random variable.

Dependencies

This package necessitates a Python version of 3 or higher. Additional required packages can be found in the environment file of this repository.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

mathdistops was created by Katherine Chen, Kun Ya, Oak Chong, Sandra Gross. It is licensed under the terms of the MIT license.

Credits

mathdistops was created with a template tool cookiecutter and the py-pkgs-cookiecutter template.

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

mathdistops-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

mathdistops-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mathdistops-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.18 Windows/10

File hashes

Hashes for mathdistops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c8df6c2056404255d8d8dc8fd413c233f364cb27650b1712f3df1ad07d7ccac
MD5 88a83bed6f7fedebf9578b2de9daed76
BLAKE2b-256 1ec554c4ae7d024f01ec64c72eedcb71c7c36546dcd610e54a67a7323498db51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mathdistops-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.18 Windows/10

File hashes

Hashes for mathdistops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0e2ee57582d05be2b2449e5b2ac7cc3ec6b5b3f79b6244dc237b3512dc880f0
MD5 d52a8c7570096b116c881d3739f16ed5
BLAKE2b-256 7f54f144fc5b7537aa3fed75b95cae2e965f8366775002b4ccc981ba49a8434b

See more details on using hashes here.

Supported by

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