 # QQ_plot_semiparametric

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

A QQ plot (quantile-quantile plot) consists of plotting failure units vs failure units for shared quantiles. A quantile is simply the fraction failing (ranging from 0 to 1). When we have two parametric distributions we can plot the failure times for common quanitles against one another using QQ_plot_parametric. QQ_plot_semiparametric is a semiparametric form of a QQ plot in which we obtain theoretical quantiles using a non-parametric estimate and a specified distribution. To generate this plot we begin with the failure units (these may be units of time, strength, cycles, landings, etc.). We then obtain an emprical CDF using either Kaplan-Meier, Nelson-Aalen, or Rank Adjustment. The empirical CDF gives us the quantiles we will use to equate the actual and theoretical failure times. Once we have the empirical CDF, we use the inverse survival function of the specified distribution to obtain the theoretical failure times and then plot the actual and theoretical failure times together. If the specified distribution is a good fit, then the QQ plot should be a reasonably straight line along the diagonal. The primary purpose of this plot is as a graphical goodness of fit test.

Parameters:
• X_data_failures (list, array) – The failure times. These will be plotted along the X-axis.

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

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

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

• show_fitted_lines (bool) – Default = True. These are the Y=m.X and Y=m.X+c lines of best fit.

• show_diagonal_line (bool) – Default = False. 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:

model_parameters (list) – [m,m1,c1] - these are the values for the lines of best fit. m is used in Y=m.X, and m1 and c1 are used in Y=m1.X+c1

Notes

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