
KaplanMeier¶
-
class
reliability.Nonparametric.
KaplanMeier
(failures=None, right_censored=None, show_plot=True, print_results=True, plot_CI=True, CI=0.95, plot_type='SF', **kwargs)¶ Uses the Kaplan-Meier estimation method to calculate the reliability from failure data. Right censoring is supported and confidence bounds are provided.
Parameters: - failures (array, list) – The failure data. Must have at least 2 elements.
- right_censored (array, list, optional) – The right censored data. Optional input. Default = None.
- show_plot (bool, optional) – True or False. Default = True
- print_results (bool, optional) – Prints a dataframe of the results. True or False. Default = True
- plot_type (str) – Must be either ‘SF’, ‘CDF’, or ‘CHF’. Default is SF.
- CI (float, optional) – confidence interval for estimating confidence limits on parameters. Must be between 0 and 1. Default is 0.95 for 95% CI.
- plot_CI (bool) – Shades the upper and lower confidence interval. True or False. Default = True
- kwargs – Plotting keywords that are passed directly to matplotlib for the plot (e.g. color, label, linestyle)
Returns: - results (dataframe) – A pandas dataframe of results for the SF
- KM (array) – The Kaplan-Meier Estimate column from results dataframe. This column is the non-parametric estimate of the Survival Function (reliability function).
- xvals (array) – the x-values to plot the stepwise plot as seen when show_plot=True
- SF (array) – survival function stepwise values (these differ from the KM values as there are extra values added in to make the plot into a step plot)
- CDF (array) – cumulative distribution function stepwise values
- CHF (array) – cumulative hazard function stepwise values
- SF_lower (array) – survival function stepwise values for lower CI
- SF_upper (array) – survival function stepwise values for upper CI
- CDF_lower (array) – cumulative distribution function stepwise values for lower CI
- CDF_upper (array) – cumulative distribution function stepwise values for upper CI
- CHF_lower (array) – cumulative hazard function stepwise values for lower CI
- CHF_upper (array) – cumulative hazard function stepwise values for upper CI
- data (array) – the failures and right_censored values sorted. Same as ‘Failure times’ column from results dataframe
- censor_codes (array) – the censoring codes (0 or 1) from the sorted data. Same as ‘Censoring code (censored=0)’ column from results dataframe
Notes
The confidence bounds are calculated using the Greenwood formula with Normal approximation, which is the same as featured in Minitab.
The Kaplan-Meier method provides the SF. The CDF and CHF are obtained from transformations of the SF. It is not possible to obtain a useful version of the PDF or HF as the derivative of a stepwise function produces discontinuous (jagged) functions.