Fit_Gamma_3P(failures=None, right_censored=None, show_probability_plot=True, print_results=True, CI=0.95, optimizer=None, method='MLE', quantiles=None, CI_type='time', downsample_scatterplot=True, **kwargs)¶
Fits a three parameter Gamma distribution (alpha,beta,gamma) to the data provided.
- failures (array, list) – The failure data. Must have at least 3 elements.
- right_censored (array, list, optional) – The right censored data. Optional input. Default = None.
- show_probability_plot (bool, optional) – True or False. Default = True
- print_results (bool, optional) – Prints a dataframe of the point estimate, standard error, Lower CI and Upper CI for each parameter. True or False. Default = True
- method (str, optional) – The method used to fit the distribution. Must be either ‘MLE’ (maximum likelihood estimation), or ‘LS’ (least squares estimation). Default is ‘MLE’.
- optimizer (str, optional) – The optimization algorithm used to find the solution. Must be either ‘TNC’, ‘L-BFGS-B’, ‘nelder-mead’, or ‘powell’. Specifying the optimizer will result in that optimizer being used. To use all of these specify ‘best’ and the best result will be returned. The default behaviour is to try each optimizer in order (‘TNC’, ‘L-BFGS-B’, ‘nelder-mead’, and ‘powell’) and stop once one of the optimizers finds a solution. If the optimizer fails, the initial guess will be returned. For more detail see the documentation.
- CI (float, optional) – confidence interval for estimating confidence limits on parameters. Must be between 0 and 1. Default is 0.95 for 95% CI.
- CI_type (str, None, optional) – This is the confidence bounds on time or reliability shown on the plot. Use None to turn off the confidence intervals. Must be either ‘time’, ‘reliability’, or None. Default is ‘time’. Some flexibility in names is allowed (eg. ‘t’, ‘time’, ‘r’, ‘rel’, ‘reliability’ are all valid).
- quantiles (bool, str, list, array, None, optional) – quantiles (y-values) to produce a table of quantiles failed with lower, point, and upper estimates. Default is None which results in no output. To use default array [0.01, 0.05, 0.1,…, 0.95, 0.99] set quantiles as either ‘auto’, True, ‘default’, ‘on’. If an array or list is specified then it will be used instead of the default array. Any array or list specified must contain values between 0 and 1.
- 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 True. 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 for the probability plot (e.g. color, label, linestyle)
- alpha (float) – the fitted Gamma_3P alpha parameter
- beta (float) – the fitted Gamma_3P beta parameter
- mu (float) – mu = ln(alpha). Alternate parametrisation (mu, beta) used for the confidence intervals.
- gamma (float) – the fitted Gamma_3P gamma parameter
- alpha_SE (float) – the standard error (sqrt(variance)) of the parameter
- beta_SE (float) – the standard error (sqrt(variance)) of the parameter
- mu_SE (float) – the standard error (sqrt(variance)) of the parameter
- gamma_SE (float) – the standard error (sqrt(variance)) of the parameter
- Cov_alpha_beta (float) – the covariance between the parameters
- Cov_mu_beta (float) – the covariance between the parameters
- alpha_upper (float) – the upper CI estimate of the parameter
- alpha_lower (float) – the lower CI estimate of the parameter
- beta_upper (float) – the upper CI estimate of the parameter
- beta_lower (float) – the lower CI estimate of the parameter
- mu_upper (float) – the upper CI estimate of the parameter
- mu_lower (float) – the lower CI estimate of the parameter
- gamma_upper (float) – the upper CI estimate of the parameter
- gamma_lower (float) – the lower CI estimate of the parameter
- loglik (float) – Log Likelihood (as used in Minitab and Reliasoft)
- loglik2 (float) – LogLikelihood*-2 (as used in JMP Pro)
- AICc (float) – Akaike Information Criterion
- BIC (float) – Bayesian Information Criterion
- AD (float) – the Anderson Darling (corrected) statistic (as reported by Minitab)
- distribution (object) – a Gamma_Distribution object with the parameters of the fitted distribution
- results (dataframe) – a pandas dataframe of the results (point estimate, standard error, lower CI and upper CI for each parameter)
- goodness_of_fit (dataframe) – a pandas dataframe of the goodness of fit values (Log-likelihood, AICc, BIC, AD).
- quantiles (dataframe) – a pandas dataframe of the quantiles with bounds on time. This is only produced if quantiles is not None. Since quantiles defaults to None, this output is not normally produced.
- probability_plot (object) – the axes handle for the probability plot. This is only returned if show_probability_plot = True
If the fitting process encounters a problem a warning will be printed. This may be caused by the chosen distribution being a very poor fit to the data or the data being heavily censored. If a warning is printed, consider trying a different optimizer.
If the fitted gamma parameter is less than 0.01, the Gamma_3P results will be discarded and the Gamma_2P distribution will be fitted. The returned values for gamma and gamma_SE will be 0.
This is a three parameter distribution but it has two parametrisations. These are alpha,beta,gamma and mu,beta,gamma. The alpha,beta,gamma parametrisation is reported in the results table while the mu,beta,gamma parametrisation is accessible from the results by name. The reason for this is because the most common parametrisation (alpha,beta,gamma) should be reported while the less common parametrisation (mu,beta,gamma) is used by some other software so is provided for convenience of comparison. The mu = ln(alpha) relationship is simple but this relationship does not extend to the variances or covariances so additional calculations are required to find both solutions. The mu,beta,gamma parametrisation is used for the confidence intervals as it is more stable.
LL_abg(params, T_f, T_rc)¶
LL_mbg(params, T_f, T_rc)¶
logR_abg(t, a, b, g)¶
logR_mbg(t, m, b, g)¶
logf_abg(t, a, b, g)¶
logf_mbg(t, m, b, g)¶