https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

Exponential_Distribution

class reliability.Distributions.Exponential_Distribution(Lambda=None, gamma=0, **kwargs)

Exponential probability distribution

Creates a Distribution object.

Inputs: Lambda - scale (rate) parameter gamma - threshold (offset) parameter. Default = 0

Methods: name - ‘Exponential’ name2 - ‘Exponential_1P’ or ‘Exponential_2P’ depending on the value of the gamma parameter param_title_long - Useful in plot titles, legends and in printing strings. eg. ‘Exponential Distribution (λ=5)’ param_title - Useful in plot titles, legends and in printing strings. eg. ‘λ=5’ parameters - [Lambda,gamma] Lambda gamma mean variance standard_deviation skewness kurtosis excess_kurtosis median mode b5 b95 plot() - plots all functions (PDF,CDF,SF,HF,CHF) PDF() - plots the probability density function CDF() - plots the cumulative distribution function SF() - plots the survival function (also known as reliability function) HF() - plots the hazard function CHF() - plots the cumulative hazard function quantile() - Calculates the quantile (time until a fraction has failed) for a given fraction failing.

Also known as b life where b5 is the time at which 5% have failed.

inverse_SF() - the inverse of the Survival Function. This is useful when producing QQ plots. mean_residual_life() - Average residual lifetime of an item given that the item has survived up to a given time.

Effectively the mean of the remaining amount (right side) of a distribution at a given time.

stats() - prints all the descriptive statistics. Same as the statistics shown using .plot() but printed to console. random_samples() - draws random samples from the distribution to which it is applied. Same as rvs in scipy.stats.

CDF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)

Plots the CDF (cumulative distribution function)

Inputs: show_plot - True/False. Default is True xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *plotting keywords are also accepted (eg. color, linestyle)

Outputs: yvals - this is the y-values of the plot The plot will be shown if show_plot is True (which it is by default). If the distribution object contains Lambda_lower and Lambda_upper, the CI bounds will be plotted. The bounds for the CI are the same as the Fitter was given (default is 0.95). To hide the CI bounds specify show_CI=False

CHF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)

Plots the CHF (cumulative hazard function)

Inputs: show_plot - True/False. Default is True xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *plotting keywords are also accepted (eg. color, linestyle)

Outputs: yvals - this is the y-values of the plot The plot will be shown if show_plot is True (which it is by default). If the distribution object contains Lambda_lower and Lambda_upper, the CI bounds will be plotted. The bounds for the CI are the same as the Fitter was given (default is 0.95). To hide the CI bounds specify show_CI=False

HF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)

Plots the HF (hazard function)

Inputs: show_plot - True/False. Default is True xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *plotting keywords are also accepted (eg. color, linestyle)

Outputs: yvals - this is the y-values of the plot The plot will be shown if show_plot is True (which it is by default).

PDF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)

Plots the PDF (probability density function)

Inputs: show_plot - True/False. Default is True xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *plotting keywords are also accepted (eg. color, linestyle)

Outputs: yvals - this is the y-values of the plot The plot will be shown if show_plot is True (which it is by default).

SF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)

Plots the SF (survival function)

Inputs: show_plot - True/False. Default is True xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *plotting keywords are also accepted (eg. color, linestyle)

Outputs: yvals - this is the y-values of the plot The plot will be shown if show_plot is True (which it is by default). If the distribution object contains Lambda_lower and Lambda_upper, the CI bounds will be plotted. The bounds for the CI are the same as the Fitter was given (default is 0.95). To hide the CI bounds specify show_CI=False

inverse_SF(q)

Inverse Survival function calculator

Parameters:q – quantile to be calculated
Returns:the inverse of the survival function at q
mean_residual_life(t)

Mean Residual Life calculator

Parameters:t – time at which MRL is to be evaluated
Returns:MRL
plot(xvals=None, xmin=None, xmax=None)

Plots all functions (PDF, CDF, SF, HF, CHF) and descriptive statistics in a single figure

Inputs: xvals - x-values for plotting xmin - minimum x-value for plotting xmax - maximum x-value for plotting *If xvals is specified, it will be used. If xvals is not specified but xmin and xmax are specified then an array with 200 elements will be created using these ranges. If nothing is specified then the range will be based on the distribution’s parameters. *no plotting keywords are accepted

Outputs: The plot will be shown. No need to use plt.show()

quantile(q)

Quantile calculator

Parameters:q – quantile to be calculated
Returns:the probability (area under the curve) that a random variable from the distribution is < q
random_samples(number_of_samples, seed=None)

Draws random samples from the probability distribution

Parameters:
  • number_of_samples – the number of samples to be drawn
  • seed – the random seed. Default is None
Returns:

the random samples

stats()

Descriptive statistics of the probability distribution. Same as the statistics shown using .plot() but printed to console. No inputs or outputs.