
Beta_Distribution
- class reliability.Distributions.Beta_Distribution(alpha=None, beta=None)
Beta probability distribution. Creates a probability distribution object.
- Parameters:
alpha (float, int) – Shape parameter 1. Must be > 0
beta (float, int) – Shape parameter 2. Must be > 0
- Returns:
name (str) – ‘Beta’
name2 (‘str) – ‘Beta_2P’
param_title_long (str) – ‘Beta Distribution (α=5,β=2)’
param_title (str) – ‘α=5,β=2’
parameters (list) – [alpha,beta]
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 not accepted
- CDF(xvals=None, xmin=None, xmax=None, show_plot=True, **kwargs)
Plots the CDF (cumulative distribution function)
- Parameters:
show_plot (bool, optional) – 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, float) – The y-values of the plot
Notes
The plot will be shown if show_plot is True (which it is by default).
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, optional) – 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, float) – The y-values of the plot
Notes
The plot will be shown if show_plot is True (which it is by default).
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, optional) – 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, float) – The y-values of the plot
Notes
The plot will be shown if show_plot is True (which it is by default).
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, optional) – 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, float) – The y-values of the plot
Notes
The plot will be shown if show_plot is True (which it is by default).
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, optional) – 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, float) – The y-values of the plot
Notes
The plot will be shown if show_plot is True (which it is by default).
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, list, array) – Quantile to be calculated. Must be between 0 and 1.
- Returns:
x (float, array) – 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, list, array) – Quantile to be calculated. Must be between 0 and 1.
- Returns:
x (float, array) – 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