Exact algorithm for computing two-sided statistical tolerance intervals under a normal distribution assumption using Python.

Overview

norm-tol-int

Exact algorithm for computing two-sided statistical tolerance intervals under a normal distribution assumption using Python.

Methods

The function tolerance_factor computes (by Gauss-Kronod quadrature) the exact tolerance factor k for the two-sided coverage-content and (1-alpha)-confidence tolerance interval

TI = [Xmean - k * S, Xmean + k * S]

where Xmean = mean(X), S = std(X), X = [X_1,...,X_n] is a random sample of size n from the distribution N(mu,sig2) with unknown mean mu and variance sig2.

The algorithm is a Python port of the MATLAB algorithm ToleranceFactor, contributed to the MATLAB Central File Exchange by Viktor Witkovsky. The port attempts to preserve the basic function structure of the algorithm so comparisons back against the MATLAB code are easier to conduct.

For more details on statistical tolerance intervals the technical background on how to compute them, see the following references:

  • Krishnamoorthy K, Mathew T. (2009). Statistical Tolerance Regions: Theory, Applications, and Computation. John Wiley & Sons, Inc., Hoboken, New Jersey. ISBN: 978-0-470-38026-0, 512 pages.
  • Meeker, William Q.; Hahn, Gerald J.; Escobar, Luis A.. Statistical Intervals: A Guide for Practitioners and Researchers (Wiley Series in Probability and Statistics). Wiley.
  • Witkovsky V. On the exact two-sided tolerance intervals for univariate normal distribution and linear regression. Austrian Journal of Statistics 43(4), 2014, 279-92. http:// ajs.data-analysis.at/index.php/ajs/article/viewFile/vol43-4-6/35
  • ISO 16269-6:2014: Statistical interpretation of data - Part 6: Determination of statistical tolerance intervals.
  • Janiga I., Garaj I.: Two-sided tolerance limits of normal distributions with unknown means and unknown common variability. MEASUREMENT SCIENCE REVIEW, Volume 3, Section 1, 2003, 75-78.

Example

The notebook example.ipynb provides a very brief application example.

Environment

The file environment.yml can be used to produce a conda environment suitable for running the example notebook and the unit tests.

Unit Tests

The algorithm accurately reproduces tables of two-sided normal tolerance interval factors from standard sources, including the complete set of tables in ISO 16269-6:2014 Annex F. The unit tests included here represent a sampling of that reproduction for brevity.

To run all the unit tests, invoke the following:

python -m unittest discover -v

License

MIT License

You might also like...
Algorithm for Cutting Stock Problem using Google OR-Tools. Link to the tool:
Algorithm for Cutting Stock Problem using Google OR-Tools. Link to the tool:

Cutting Stock Problem Cutting Stock Problem (CSP) deals with planning the cutting of items (rods / sheets) from given stock items (which are usually o

FingerPy is a algorithm to measure, analyse and monitor heart-beat using only a video of the user's finger on a mobile cellphone camera.
FingerPy is a algorithm to measure, analyse and monitor heart-beat using only a video of the user's finger on a mobile cellphone camera.

FingerPy is a algorithm using python, scipy and fft to measure, analyse and monitor heart-beat using only a video of the user's finger on a m

This is an Airport Scheduling Time table implemented using Genetic Algorithm

This is an Airport Scheduling Time table implemented using Genetic Algorithm In this The scheduling is performed on the basisi of that no two Air planes are arriving or departing at the same runway at the same time and day there are total of 4 Airplanes 3 and 3 Runways.

Wordle-solver - A program that solves a Wordle using a simple algorithm

Wordle Solver A program that solves a Wordle using a simple algorithm. To see it

This application solves sudoku puzzles using a backtracking recursive algorithm

This application solves sudoku puzzles using a backtracking recursive algorithm. The user interface is coded with Pygame to allow users to easily input puzzles.

 N Queen Problem using Genetic Algorithm
N Queen Problem using Genetic Algorithm

The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other.

A fast python implementation of the SimHash algorithm.

This Python package provides hashing algorithms for computing cohort ids of users based on their browsing history. As such, it may be used to compute cohort ids of users following Google's Federated Learning of Cohorts (FLoC) proposal.

A genetic algorithm written in Python for educational purposes.
A genetic algorithm written in Python for educational purposes.

Genea: A Genetic Algorithm in Python Genea is a Genetic Algorithm written in Python, for educational purposes. I started writing it for fun, while lea

An implementation of ordered dithering algorithm in python as multimedia course project
An implementation of ordered dithering algorithm in python as multimedia course project

One way of minimizing the size of an image is to simply reduce the number of bits you use to represent each pixel.

Owner
Jed Ludlow
Multidisciplinary Engineer
Jed Ludlow
Using A * search algorithm and GBFS search algorithm to solve the Romanian problem

Romanian-problem-using-Astar-and-GBFS Using A * search algorithm and GBFS search algorithm to solve the Romanian problem Romanian problem: The agent i

Mahdi Hassanzadeh 6 Nov 22, 2022
Algorithms for calibrating power grid distribution system models

Distribution System Model Calibration Algorithms The code in this library was developed by Sandia National Laboratories under funding provided by the

Sandia National Laboratories 2 Oct 31, 2022
A Python Package for Portfolio Optimization using the Critical Line Algorithm

A Python Package for Portfolio Optimization using the Critical Line Algorithm

null 19 Oct 11, 2022
A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD.

8QueensGenetic A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD. The project uses the Kivy cross-p

Ahmed Gad 16 Nov 13, 2022
A Python program to easily solve the n-queens problem using min-conflicts algorithm

QueensProblem A program to easily solve the n-queens problem using min-conflicts algorithm Performances estimated with a sample of 1000 different rand

null 0 Oct 21, 2022
Data Model built using Logistic Regression Algorithm on Python.

Logistic-Regression Problem Statement: Your client is a retail banking institution. Term deposits are a major source of income for a bank. A term depo

Hemanth Babu Muthineni 0 Dec 25, 2021
Sorting Algorithm Visualiser using pygame

SortingVisualiser Sorting Algorithm Visualiser using pygame Features Visualisation of some traditional sorting algorithms like quicksort and bubblesor

null 4 Sep 5, 2021
🧬 Training the car to do self-parking using a genetic algorithm

?? Training the car to do self-parking using a genetic algorithm

Oleksii Trekhleb 652 Jan 3, 2023
A tictactoe where you never win, implemented using minimax algorithm

Unbeatable_TicTacToe A tictactoe where you never win, implemented using minimax algorithm Requirements Make sure you have the pygame module along with

Jessica Jolly 3 Jul 28, 2022
Sign data using symmetric-key algorithm encryption.

Sign data using symmetric-key algorithm encryption. Validate signed data and identify possible validation errors. Uses sha-(1, 224, 256, 385 and 512)/hmac for signature encryption. Custom hash algorithms are allowed. Useful shortcut functions for signing (and validating) dictionaries and URLs.

Artur Barseghyan 39 Jun 10, 2022