Skip to content

Commit

Permalink
changes for v0.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewReid854 committed Jan 28, 2023
1 parent d9e68f5 commit 3a06549
Show file tree
Hide file tree
Showing 16 changed files with 1,506 additions and 754 deletions.
30 changes: 30 additions & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@
Changelog
---------

**Version: 0.8.7 --- Released: 28 Jan 2023**
''''''''''''''''''''''''''''''''''''''''''''

**Summary of changes**

This is primarily a bugfix release, with some minor API changes and new features.

**New features**

- Reliability_testing.likelihood_plot is a new function to generate a likelihood plot. See the `documentation <https://reliability.readthedocs.io/en/latest/likelihood%20plot.html>`_ for more detail.

**API Changes**

- Utils.round_to_decimals has been replaced by Utils.round_and_string. This function always returns a string and the rounding rules applied are better than before as they apply scientific notation for very large and very small numbers. This was an issue in plot titles and plot text where very large numbers weren't being displayed in scientific notation.
- Within Fitters and Distributions that have been created by Fitters, the confidence intervals can be turned off using 'none'. Previously this was None which caused some issues with confidence interval inheritance between Fitters and Distributions and an inability to turn them off when called from Distributions.
- Utils.life_stress_plot will swap the x and y axes if ax='swap'. This is useful for making a stress-life plot which is similar to an SN_diagram.
- All of the ALT_Fitters will now accept show_life_stress_plot='swap' to return a stress-life plot by swapping the axes of the standard life-stress plot.

**Bug Fixes**

- The axes limits for the histogram plot in Fit_Everything crashed when a left asymptote occurred.
- KStest and chi2test now accept Mixture Model, Competing Risks Model, and DSZI model for the distribution.
- The line of best fit in life stress plots started at 1. This was a problem for data less than 1. The line of best fit now starts at 0.
- When using force_beta with RRX in Fit_Weibull_2P, the beta that is returned is the inverse of force_beta. This only occurred for RRX for Fit_Weibull_2P. Thanks to Github user ctenold for identifying this bug and providing the solution in `this issue <https://github.com/MatthewReid854/reliability/issues/32>`_.

**Other**

- Added a new textbook to Recommended resources.
- The CDF, SF, and CHF methods in Distributions did not include all the parameters in the documentation.

**Version: 0.8.6 --- Released: 06 Aug 2022**
''''''''''''''''''''''''''''''''''''''''''''

Expand Down
2 changes: 1 addition & 1 deletion docs/Development roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Development roadmap
'''''''''''''''''''

Development of *reliability* has transitioned to primarily codebase maintenance (bug fixes).
As of January 2022, development of *reliability* has transitioned to primarily codebase maintenance (bug fixes).
I am turning my attention to learning Web Development in order to bring the power of this library to an interactive Web Application.
I hope this approach will help a wider audience who may not be familiar enough with Python to use this library in its current form.
If you're an experienced web developer and willing to help get this project off the ground, please get in touch via email (alpha.reliability@gmail.com).
Expand Down
36 changes: 36 additions & 0 deletions docs/Likelihood plot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. image:: images/logo.png

-------------------------------------

Likelihood plot
'''''''''''''''

The likelihood plot provides a graphical representation of the confidence bounds on the parameters of a distribution at a particular confidence interval.
When multiple distributions (of the same type) are plotted together, it is possible to determine whether there is a statistically significant difference between them by looking at whether their likelihood plots overlap.

Please note that it is not possible to overlay the likelihood plots of different types of distributions (e.g. Weibull and Normal) on the same plot because the axes must match.

The likelihood plot is only implemented for 2P distributions (Weibull, Normal, Lognormal, Gamma, Gumbel, Loglogistic, Beta) that are not location shifted. To compare two Exponential_1P distributions, simply look for overlap on the confidence bounds on the lambda parameter.

.. admonition:: API Reference

For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/Reliability_testing/likelihood_plot.html>`_.

In the example below we have two datasets that are from two different design iterations of the same component. We want to know if the new design really is better than the old design. The parameters of the distribution certainly seem different, but is there a statistically significant difference between the distributions? To find out we need to plot the confidence bounds on the parameters. This is done at the 90% and 95% confidence levels.

The resulting plot shows that there is no overlap at the 90% confidence level, but there is a small overlap at the 95% confidence level. From this plot we can say that we are 90% confident that the new design is better than the old one, but at the 95% confidence level, there is not a statistically significant difference between the two designs.

.. code:: python
from reliability.Reliability_testing import likelihood_plot
import matplotlib.pyplot as plt
old_design = [2, 9, 23, 38, 67, 2, 11, 28, 40, 76, 3, 17, 33, 45, 90, 4, 17, 34, 55, 115, 6, 19, 34, 56, 126, 9, 21, 37, 57, 197]
new_design = [15, 116, 32, 148, 61, 178, 67, 181, 75, 183]
likelihood_plot(distribution="Weibull", failures=old_design, CI=[0.9, 0.95])
likelihood_plot(distribution="Weibull", failures=new_design, CI=[0.9, 0.95])
plt.show()
.. image:: images/likelihood_plot.png

This example uses the same data as the `example from reliawiki <https://www.reliawiki.com/index.php/Contour_Plot_Example>`_.
1 change: 1 addition & 0 deletions docs/Recommended resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following collection of resources are things I have found useful during my r
- `Probability Distributions Used in Reliability Engineering (2011), by A. O'Conner, M. Modarres, and A. Mosleh. <https://crr.umd.edu/sites/crr.umd.edu/files/Free%20Ebook%20Probability%20Distributions%20Used%20in%20Reliability%20Engineering.pdf>`_
- Practical Reliability Engineering, Fifth Edition (2012), by P. O'Conner and A. Kleyner.
- Recurrent Events Data Analysis for Product Repairs, Disease Recurrences, and Other Applications (2003), by W. Nelson
- Reliability Analysis Using MINITAB and Python (2022), by J. Hwang. This textbook provides many examples using `reliability` and also a few examples with `surpyval`. The version of `reliability` used in the book is 0.8.1 which is significantly different from the most recent version.
- Reliasoft has compiled a much more comprehensive `list of textbooks <https://www.weibull.com/knowledge/books.htm>`_.
- The reliability analytics toolkit (linked below in free online tools and calculators) has also compiled a much more comprehensive `list of textbooks <https://reliabilityanalyticstoolkit.appspot.com/static/books.htm#0486438678>`_.

Expand Down
Binary file added docs/images/likelihood_plot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Contents:
Reliability test duration
Chi-squared test
Kolmogorov-Smirnov test
Likelihood plot

.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit 3a06549

Please sign in to comment.