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

PP_plot_semiparametric

class reliability.Probability_plotting.PP_plot_semiparametric(X_data_failures=None, X_data_right_censored=None, Y_dist=None, show_diagonal_line=True, method='KM', downsample_scatterplot=False, **kwargs)

A PP plot (probability-probability plot) consists of plotting the CDF of one distribution against the CDF of another distribution. If we have both distributions we can use the function PP_plot_parametric. This function is for when we want to compare a fitted distribution to an empirical distribution for a given set of data. If the fitted distribution is a good fit the PP plot will lie on the diagonal line. The main purpose of this type of plot is to assess the goodness of fit in a graphical way. To create a semi-parametric PP plot, we must provide the failure data and the method (‘KM’ for Kaplan-Meier, ‘NA’ for Nelson-Aalen, ‘RA’ for Rank Adjustment) to estimate the empirical CDF, and we must also provide the parametric distribution for the parametric CDF. The failure times are the limiting values here so the parametric CDF is only calculated at the failure times since that is the result from the empirical CDF.

Parameters:
  • X_data_failures (array, list) – The failure times.

  • X_data_right_censored (array, list, optional) – The right censored failure times. Optional input.

  • Y_dist (object) – A probability distribution created using the reliability.Distributions module. The CDF of this distribution will be plotted along the Y-axis.

  • method (str, optional) – Must be ‘KM’, ‘NA’, or ‘RA’ for Kaplan-Meier, Nelson-Aalen, and Rank Adjustment respectively. Default = ‘KM’.

  • show_diagonal_line (bool) – Default = True. If True the diagonal line will be shown on the plot.

  • downsample_scatterplot (bool, int, optional) – If True or None, and there are over 1000 points, then the scatterplot will be downsampled by a factor. The default downsample factor will seek to produce between 500 and 1000 points. If a number is specified, it will be used as the downsample factor. Default is False which will result in no downsampling. This functionality makes plotting faster when there are very large numbers of points. It only affects the scatterplot not the calculations.

  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, label, linestyle).

Returns:

figure (object) – The figure handle of the PP plot is returned as an object

Notes

The empirical CDF also accepts X_data_right_censored just as Kaplan-Meier, Nelson-Aalen, and Rank Adjustment will also accept right censored data.

If your plot does not appear automatically, use plt.show() to show it.