Fit_Everything_ALT(failures, failure_stress_1, failure_stress_2=None, right_censored=None, right_censored_stress_1=None, right_censored_stress_2=None, use_level_stress=None, CI=0.95, optimizer=None, show_probability_plot=True, show_best_distribution_probability_plot=True, print_results=True, exclude=None, sort_by='BIC')¶
This function will fit all available ALT models for the data you enter, which may include right censored data.
ALT models are either single stress (Exponential, Eyring, Power) or dual stress (Dual_Exponential, Power_Exponential, Dual_Power). Depending on the data you enter (ie. whether failure_stress_2 is provided), the applicable set of ALT models will be fitted.
Inputs: failures - an array or list of the failure times (this does not need to be sorted). failure_stress_1 - an array or list of the corresponding stresses (such as temperature or voltage) at which each failure occurred.This must match the length of failures as each failure is tied to a failure stress.
- failure_stress_2 - an array or list of the corresponding stresses (such as temperature or voltage) at which each failure occurred.
- This must match the length of failures as each failure is tied to a failure stress. Optional input. Providing this will trigger the use of dual stress models. Leaving this empty will trigger the use of single stress models.
right_censored - an array or list of the right failure times (this does not need to be sorted). Optional Input. right_censored_stress_1 - an array or list of the corresponding stresses (such as temperature or voltage) at which each right_censored data point was obtained.This must match the length of right_censored as each right_censored value is tied to a right_censored stress.
- right_censored_stress_2 - an array or list of the corresponding stresses (such as temperature or voltage) at which each right_censored data point was obtained.
- This must match the length of right_censored as each right_censored value is tied to a right_censored stress. Conditionally optional input. This must be provided if failure_stress_2 is provided.
- use_level_stress - The use level stress at which you want to know the mean life. Optional input.
- This must be a list [stress_1,stress_2] if failure_stress_2 is provided.
print_results - True/False. Default is True show_probability_plot - True/False. Default is True. Provides a probability plot of each of the fitted ALT model. show_best_distribution_probability_plot - True/False. Defaults to True. Provides a probability plot in a new figure of the best ALT model. CI - confidence interval for estimating confidence limits on parameters. Must be between 0 and 1. Default is 0.95 for 95% CI. optimizer - ‘TNC’, ‘L-BFGS-B’, ‘powell’. Default is ‘TNC’. These are all bound constrained methods. If the bound constrained method fails, nelder-mead will be used. If nelder-mead fails the initial guess (using least squares) will be returned with a warning. sort_by - goodness of fit test to sort results by. Must be ‘BIC’,’AICc’, or ‘Log-likelihood’. Default is BIC. exclude - list or array of strings specifying which distributions to exclude. Default is None. Options are:Weibull_Exponential Weibull_Eyring Weibull_Power Weibull_Dual_Exponential Weibull_Power_Exponential Weibull_Dual_Power Lognormal_Exponential Lognormal_Eyring Lognormal_Power Lognormal_Dual_Exponential Lognormal_Power_Exponential Lognormal_Dual_Power Normal_Exponential Normal_Eyring Normal_Power Normal_Dual_Exponential Normal_Power_Exponential Normal_Dual_Power Exponential_Exponential Exponential_Eyring Exponential_Power Exponential_Dual_Exponential Exponential_Power_Exponential Exponential_Dual_Power
Outputs: results - the dataframe of results. Fitted parameters in this dataframe may be accessed by name. See below example. best_model_name - the name of the best fitting ALT model. E.g. ‘Weibull_Exponential’. See above list for exclude. best_model_at_use_stress - a distribution object created based on the parameters of the best fitting ALT model at the use stress.This is only provided if the use_level_stress is provided. This is because use_level_stress is required to find the scale parameter.
- parameters and goodness of fit results for each fitted model. For example, the Weibull_Exponential model values are:
- Weibull_Exponential_a Weibull_Exponential_b Weibull_Exponential_beta Weibull_Exponential_BIC Weibull_Exponential_AICc Weibull_Exponential_loglik
excluded_models - a list of the models which were excluded. This will always include at least half the models since only single stress OR dual stress can be fitted depending on the data.
From the results, the models are sorted based on their goodness of fit test results, where the smaller the goodness of fit value, the better the fit of the model to the data.
Example Usage: failures = [619, 417, 173, 161, 1016, 512, 999, 1131, 1883, 2413, 3105, 2492] failure_stresses = [500, 500, 500, 500, 400, 400, 400, 400, 350, 350, 350, 350] right_censored = [29, 180, 1341] right_censored_stresses = [500, 400, 350] use_level_stress = 300 output = Fit_Everything_ALT(failures=failures,failure_stress_1=failure_stresses,right_censored=right_censored, right_censored_stress_1=right_censored_stresses, use_level_stress=use_level_stress)
To extract the parameters of the Weibull_Exponential model from the results dataframe, you may access the parameters by name: print(‘Weibull Exponential beta =’,output.Weibull_Exponential_beta) >>> Weibull Exponential beta = 3.0807072337386123