Fit_Exponential_2P(failures=None, right_censored=None, show_probability_plot=True, print_results=True, CI=0.95, quantiles=None, method='MLE', optimizer=None, downsample_scatterplot=True, **kwargs)¶
Fits a two parameter Exponential distribution (Lambda, gamma) to the data provided.
- failures (array, list) – The failure data. Must have at least 1 element.
- 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 the model’s parameter. True or False. Default = True
- method (str, optional) – The method used to fit the distribution. Must be either ‘MLE’ (maximum likelihood estimation), ‘LS’ (least squares estimation), ‘RRX’ (Rank regression on X), or ‘RRY’ (Rank regression on Y). LS will perform both RRX and RRY and return the better one. 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.
- 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)
- Lambda (float) – the fitted Exponential_1P Lambda parameter
- Lambda_inv (float) – the inverse of the fitted Exponential_1P Lambda parameter
- gamma (float) – the fitted Exponential_2P gamma parameter
- Lambda_SE (float) – the standard error (sqrt(variance)) of the parameter
- Lambda_SE_inv (float) – the standard error (sqrt(variance)) of the inverse of the parameter
- gamma_SE (float) – the standard error (sqrt(variance)) of the parameter
- Lambda_upper (float) – the upper CI estimate of the parameter
- Lambda_lower (float) – the lower CI estimate of the parameter
- Lambda_upper_inv (float) – the upper CI estimate of the inverse of the parameter
- Lambda_lower_inv (float) – the lower CI estimate of the inverse 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 Exponential_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. 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
This is a two parameter distribution (Lambda, gamma), but the results provide both Lambda as well as the inverse (1/Lambda). This is provided for convenience as some other software (Minitab and scipy.stats) use 1/Lambda instead of Lambda. Lambda_SE_inv, Lambda_upper_inv, and Lambda_lower_inv are also provided for convenience.
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.
LL(params, T_f, T_rc)¶
LL_inv(params, T_f, T_rc)¶
logR(t, L, g)¶
logf(t, L, g)¶