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

Weibull_Distribution

class reliability.Distributions.Weibull_Distribution(alpha=None, beta=None, gamma=0, **kwargs)

Weibull probability distribution. Creates a probability distribution object.

Parameters:
  • alpha (float, int) – Scale parameter. Must be > 0
  • beta (float, int) – Shape parameter. Must be > 0
  • gamma (float, int, optional) – threshold (offset) parameter. Must be >= 0. Default = 0
Returns:

  • name (str) – ‘Weibull’
  • name2 (‘str) – Weibull_2P’ or ‘Weibull_3P’ depending on the value of the gamma parameter
  • param_title_long (str) – ‘Weibull Distribution (α=5,β=2)’
  • param_title (str) – ‘α=5,β=2’
  • parameters (list) – [alpha,beta,gamma]
  • alpha (float)
  • beta (float)
  • gamma (float)
  • mean (float)
  • variance (float)
  • standard_deviation (float)
  • skewness (float)
  • kurtosis (float)
  • excess_kurtosis (float)
  • median (float)
  • mode (float)
  • b5 (float)
  • b95 (float)

Notes

kwargs are used internally to generate the confidence intervals

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

Plots the CDF (cumulative distribution function)

Parameters:
  • show_plot (bool) – True or False. Default = True
  • xvals (array, list, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, linestyle)
Returns:

  • yvals (array) – The y-values of the plot
  • The plot will be shown if show_plot is True (which it is by default).

Notes

If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters.

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

Plots the CHF (cumulative hazard function)

Parameters:
  • show_plot (bool) – True or False. Default = True
  • xvals (array, list, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, linestyle)
Returns:

  • yvals (array) – The y-values of the plot
  • The plot will be shown if show_plot is True (which it is by default).

Notes

If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters.

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

Plots the HF (hazard function)

Parameters:
  • show_plot (bool) – True or False. Default = True
  • xvals (array, list, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, linestyle)
Returns:

  • yvals (array) – The y-values of the plot
  • The plot will be shown if show_plot is True (which it is by default).

Notes

If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters.

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

Plots the PDF (probability density function)

Parameters:
  • show_plot (bool) – True or False. Default = True
  • xvals (array, list, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, linestyle)
Returns:

  • yvals (array) – The y-values of the plot
  • The plot will be shown if show_plot is True (which it is by default).

Notes

If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters.

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

Plots the SF (survival function)

Parameters:
  • show_plot (bool) – True or False. Default = True
  • xvals (array, list, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
  • kwargs – Plotting keywords that are passed directly to matplotlib (e.g. color, linestyle)
Returns:

  • yvals (array) – The y-values of the plot
  • The plot will be shown if show_plot is True (which it is by default).

Notes

If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters.

inverse_SF(q)

Inverse survival function calculator

Parameters:q (float) – Quantile to be calculated. Must be between 0 and 1.
Returns:x (float) – The inverse of the SF at q.
mean_residual_life(t)

Mean Residual Life calculator

Parameters:t (int, float) – Time (x-value) at which mean residual life is to be evaluated
Returns:MRL (float) – The mean residual life
plot(xvals=None, xmin=None, xmax=None)

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

Parameters:
  • xvals (list, array, optional) – x-values for plotting
  • xmin (int, float, optional) – minimum x-value for plotting
  • xmax (int, float, optional) – maximum x-value for plotting
Returns:

None

Notes

The plot will be shown. No need to use plt.show(). If xvals is specified, it will be used. If xvals is not specified but xmin and/or xmax are specified then an array with 200 elements will be created using these limits. If nothing is specified then the range will be based on the distribution’s parameters. No plotting keywords are accepted.

quantile(q)

Quantile calculator

Parameters:q (float) – Quantile to be calculated. Must be between 0 and 1.
Returns:x (float) – The inverse of the CDF at q. This is the probability 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 (int) – The number of samples to be drawn. Must be greater than 0.
  • seed (int, optional) – The random seed passed to numpy. Default = None
Returns:

samples (array) – The random samples

Notes

This is the same as rvs in scipy.stats

stats()

Descriptive statistics of the probability distribution. These are the same as the statistics shown using .plot() but printed to the console.

Parameters:None
Returns:None