Reliability Release 0.6.0
Total Page:16
File Type:pdf, Size:1020Kb
reliability Release 0.6.0 Jul 23, 2021 Quickstart Intro 1 Quickstart for reliability 3 2 Introduction to the field of reliability engineering7 3 Recommended resources 9 4 Equations of supported distributions 13 5 What is censored data 19 6 Creating and plotting distributions 25 7 Fitting a specific distribution to data 31 8 Fitting all available distributions to data 45 9 Mixture models 53 10 Competing risks models 63 11 DSZI models 73 12 Optimizers 87 13 Probability plots 91 14 Quantile-Quantile plots 103 15 Probability-Probability plots 109 16 Kaplan-Meier 113 17 Nelson-Aalen 119 18 Rank Adjustment 123 19 What is Accelerated Life Testing 127 20 Equations of ALT models 131 i 21 Getting your ALT data in the right format 135 22 Fitting a single stress model to ALT data 137 23 Fitting a dual stress model to ALT data 147 24 Fitting all available models to ALT data 157 25 What does an ALT probability plot show me 165 26 Datasets 171 27 Importing data from Excel 175 28 Converting data between different formats 181 29 Reliability growth 187 30 Optimal replacement time 189 31 ROCOF 193 32 Mean cumulative function 195 33 One sample proportion 201 34 Two proportion test 203 35 Sample size required for no failures 205 36 Sequential sampling chart 207 37 Reliability test planner 211 38 Reliability test duration 215 39 Chi-squared test 219 40 Kolmogorov-Smirnov test 223 41 SN diagram 227 42 Stress-strain and strain-life 231 43 Fracture mechanics 241 44 Creep 247 45 Palmgren-Miner linear damage model 251 46 Acceleration factor 253 47 Solving simultaneous equations with sympy 255 48 Stress-Strength interference 259 49 Similar Distributions 263 50 Make right censored data 265 ii 51 Make ALT data 267 52 Crosshairs 271 53 Distribution explorer 275 54 Histogram 277 55 Changelog 281 56 Development roadmap 297 57 Copyright information 299 58 Citing reliability in your work 305 59 Contributing 307 60 How to get help 309 61 How to donate to the project 311 62 About the author 313 63 Credits to those who helped 315 64 Logo 317 65 API Reference 319 Python Module Index 531 Index 533 iii iv reliability, Release 0.6.0 reliability is a Python library for reliability engineering and survival analysis. It significantly extends the functionality of scipy.stats and also includes many specialist tools that are otherwise only available in proprietary software. If you frequently use the Python Reliability Library, please consider filling out a quick survey to help guide the development of the library and this documentation. Quickstart Intro 1 reliability, Release 0.6.0 2 Quickstart Intro CHAPTER 1 Quickstart for reliability 1.1 Installation and upgrading If you are new to using Python, you will first need to install a Python 3 interpreter and also install an IDE so that you can interact with the code. There are many good IDEs available including Pycharm, Spyder and Jupyter. Once you have Python installed, to install reliability for the first time, open your command prompt and type: pip install reliability To upgrade a previous installation of reliability to the most recent version, open your command prompt and type: pip install --upgrade reliability If you would like to be notified by email of when a new release of reliability is uploaded to PyPI, there is a free service to do exactly that called NewReleases.io. 1.2 A quick example In this example, we will create a Weibull Distribution, and from that distribution we will draw 20 random samples. Using those samples we will Fit a 2-parameter Weibull Distribution. The fitting process generates the probability plot. We can then access the distribution object to plot the survival function. from reliability.Distributions import Weibull_Distribution from reliability.Fitters import Fit_Weibull_2P from reliability.Probability_plotting import plot_points import matplotlib.pyplot as plt dist= Weibull_Distribution(alpha=30, beta=2) # creates the distribution object data= dist.random_samples(20, seed=42) # draws 20 samples from the distribution. ,!Seeded for repeatability plt.subplot(121) (continues on next page) 3 reliability, Release 0.6.0 (continued from previous page) fit= Fit_Weibull_2P(failures=data) # fits a Weibull distribution to the data and ,!generates the probability plot plt.subplot(122) fit.distribution.SF(label='fitted distribution') # uses the distribution object from ,!Fit_Weibull_2P and plots the survival function dist.SF(label='original distribution', linestyle='--') # plots the survival function ,!of the original distribution plot_points(failures=data, func='SF') # overlays the original data on the survival ,!function plt.legend() plt.show() ''' Results from Fit_Weibull_2P (95% CI): Analysis method: Maximum Likelihood Estimation (MLE) Failures / Right censored: 20/0 (0% right censored) Parameter Point Estimate Standard Error Lower CI Upper CI Alpha 28.1696 3.57032 21.9733 36.1131 Beta 1.86309 0.32449 1.32428 2.62111 Goodness of fit Value Log-likelihood -79.5482 AICc 163.802 BIC 165.088 AD 0.837278 ''' 4 Chapter 1. Quickstart for reliability reliability, Release 0.6.0 A key feature of reliability is that probability distributions are created as objects, and these objects have many proper- ties (such as the mean) that are set once the parameters of the distribution are defined. Using the dot operator allows us to access these properties as well as a large number of methods (such as drawing random samples as seen in the example above). Each distribution may be visualised in five different plots. These are the Probability Density Function (PDF), Cumu- lative Distribution Function (CDF), Survival Function (SF) [also known as the reliabilty function], Hazard Function (HF), and the Cumulative Hazard Function (CHF). Accessing the plot of any of these is as easy as any of the other methods. Eg. dist.SF() in the above example is what plots the survival function using the distribution object that was returned from the fitter. 1.2. A quick example 5 reliability, Release 0.6.0 6 Chapter 1. Quickstart for reliability CHAPTER 2 Introduction to the field of reliability engineering Reliability engineering is a field of study that deals with the estimation, prevention, and management of failures by combining statistics, risk analysis, and physics. By understanding how failures may occur or have occurred, we are able to better predict the lifespan of a product or system, allowing us to manage its lifecycle and the risks associated with its failure. All engineering systems, components, and structures will eventually fail, and knowing how and when that failure will occur is of great interest to the owners and operators of those systems. Due to the similarities between the lifecycle of engineering systems and the lifecycle of humans, the field of study known as survival analysis has many concepts that are used in reliability engineering. Everyone is acutely aware of the importance of reliability, particularly when something doesn’t work at a time we expect it to. Whether it be your car not starting, your television failing, or the chance of being delayed on the runway because your aircraft’s airconditioning unit just stopped working, we know that system failure is something we all want to avoid. When it can’t be avoided, we at least want to know when it is likely to occur so we can conduct preventative maintenance before the need for corrective maintenance arises. Reliability engineering is most frequently used for systems which are of critical safety importance (such as in the nuclear industry), or in systems which are numerous (such as vehicles or electronics) where the cost of fleetwide reliability problems can quickly become very expensive. Much of reliability engineering involves the analysis of data (such as time to failure data), to uncover the patterns in how failures occur. Once we understand how things are failing, we can use those patterns to forecast how the failures will occur throughout the lifetime of a population of items, or the lifetime of one or more repairable items. It is the data analysis part of reliability engineering that this Python library is designed to help with. Further reading is available on Wikipedia and in many other reliability resources. 7 reliability, Release 0.6.0 8 Chapter 2. Introduction to the field of reliability engineering CHAPTER 3 Recommended resources The following collection of resources are things I have found useful during my reliability engineering studies and also while writing the Python reliability library. There are many other resources available (especially textbooks and academic papers), so I encourage you to do your own research. If you find something you think is worth adding here, please send me an email ([email protected]). Textbooks • Reliability Engineering and Risk Analysis: A practical Guide, Third Edition (2017), by M. Modarres, M. Kaminskiy, and V. Krivtsov. • Probabilistic Physics of Failure Approach to Reliability (2017), by M. Modarres, M. Amiri, and C. Jackson. • Probability Distributions Used in Reliability Engineering (2011), by A. O’Conner, M. Modarres, and A. Mosleh. • 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 • Reliasoft has compiled a much more comprehensive list of textbooks. • The reliability analytics toolkit (linked below in free online tools and calculators) has also compiled a much more comprehensive list of textbooks. Free software • Lifelines - a Python library for survival analysis. Very powerful collection of tools, only a few of which overlap with the Python reliability library. • Surpyval - a Python library for survival anaysis. Similar to reliability, but with an API more aligned with Scipy. Mostly focussed on fitting models (probability distributions and nonparametric). • Parameter Solver v3.0 - a biostatistics tool for quickly making some simple calculations with probability distri- butions.