https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

sequential_sampling_chart

class reliability.Reliability_testing.sequential_sampling_chart(p1, p2, alpha, beta, show_plot=True, print_results=True, test_results=None, max_samples=100)

This function plots the accept/reject boundaries for a given set of quality and risk levels. If supplied, the test results are also plotted on the chart.

A sequential sampling chart provides decision boundaries so that a success/failure test may be stopped as soon as there have been enough successes or enough failures to exceed the decision boundary. The decision boundary is calculated based on four parameters; producer’s quality, consumer’s quality, producer’s risk, and consumer’s risk. Producer’s risk is the chance that the consumer rejects a batch when they should have accepted it. Consumer’s risk is the chance that the consumer accepts a batch when they should have rejected it. We can also consider the producer’s and consumer’s quality to be the desired reliability of the sample, and the producer’s and consumer’s risk to be 1-confidence interval that the sample test result matches the population test result.

Parameters:
  • p1 (float) – The producer’s quality. This is the acceptable failure rate for the producer. Must be between 0 and 1 but is usually very small, typically around 0.01.

  • p2 (float) – The consumer’s quality. This is the acceptable failure rate for the consumer. Must be between 0 and 1 but is usually very small, typically around 0.1.

  • alpha (float) – The producer’s risk. The probability of accepting a batch when it should have been rejected. Producer’s CI = 1-alpha. Must be between 0 and 1 but is usually very small, typically 0.05.

  • beta (float) – The consumer’s risk. The probability of the consumer rejecting a batch when it should have been accepted. Consumer’s CI = 1-beta. Must be between 0 and 1 but is usually very small, typically 0.1.

  • test_results (array, list, optional) – The binary test results. eg. [0,0,0,1] represents 3 successes and 1 failure. Default=None. Use 0 for success and 1 for failure as this test is counting the number of failures.

  • show_plot (bool, optional) – If True the plot will be produced. Default = True.

  • print_results (bool, optional) – If True the results will be printed to the console. Default = True.

  • max_samples (int, optional) – The upper x-limit of the plot. Default = 100.

Returns:

results (dataframe) – A dataframe of tabulated decision results with the columns “Samples”, “Failures to accept”, “Failures to reject”. This is independent of the test_results provided.

Notes

If show_plot is True, the sequential sampling chart with decision boundaries will be produced. The test_results are only plotted on the chart if provided as an input. The chart will display automatically so plt.show() is not required.