A QQ plot is a quantile-quantile plot which 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.
Inputs: X_data_failures - the failure times in an array or list. These will be plotted along the X-axis. X_data_right_censored - the right censored failure times in an array or list. Optional input. Y_dist - a probability distribution. The quantiles of this distribution will be plotted along the Y-axis. method - ‘KM’, ‘NA’, or ‘RA’ for Kaplan-Meier, Nelson-Aalen, and Rank-Adjustment respectively. Default is ‘KM’ show_fitted_lines - True/False. Default is True. These are the Y=mX and Y=mX+c lines of best fit. show_diagonal_line - True/False. Default is False. If True the diagonal line will be shown on the plot.
Outputs: The QQ_plot will always be output. Use plt.show() to show it. [m,m1,c1] - these are the values for the lines of best fit. m is used in Y=mX, and m1 and c1 are used in Y=m1X+c1