pub struct ReliabilityAnalysis { /* private fields */ }Expand description
Reliability analysis results from a fitted Weibull distribution.
Computes reliability engineering metrics (reliability function, hazard rate, MTBF, B-life) from Weibull shape (beta) and scale (eta) parameters.
§Mathematical Background
Given a Weibull distribution with shape beta > 0 and scale eta > 0:
- Reliability: R(t) = exp(-(t/eta)^beta)
- Hazard rate: lambda(t) = (beta/eta) * (t/eta)^(beta-1)
- MTBF: eta * Gamma(1 + 1/beta)
§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
assert!((ra.reliability(0.0) - 1.0).abs() < 1e-10);
assert!(ra.hazard_rate(50.0) > 0.0);
assert!(ra.mtbf() > 0.0);
let b10 = ra.b_life(0.10).unwrap();
assert!(b10 > 0.0 && b10 < 100.0);§Reference
Meeker & Escobar (1998), Statistical Methods for Reliability Data, Wiley.
Implementations§
Source§impl ReliabilityAnalysis
impl ReliabilityAnalysis
Sourcepub fn new(shape: f64, scale: f64) -> Option<Self>
pub fn new(shape: f64, scale: f64) -> Option<Self>
Creates a new reliability analysis from Weibull parameters.
§Arguments
shape- Shape parameter beta (must be positive and finite)scale- Scale parameter eta (must be positive and finite)
§Returns
None if either parameter is non-positive or non-finite.
§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0);
assert!(ra.is_some());
// Invalid parameters return None
assert!(ReliabilityAnalysis::new(-1.0, 100.0).is_none());
assert!(ReliabilityAnalysis::new(2.0, 0.0).is_none());Sourcepub fn from_mle(result: &WeibullMleResult) -> Self
pub fn from_mle(result: &WeibullMleResult) -> Self
Creates a reliability analysis from an MLE fitting result.
§Panics
This function does not panic. MLE results always have valid parameters.
Sourcepub fn from_mrr(result: &WeibullMrrResult) -> Self
pub fn from_mrr(result: &WeibullMrrResult) -> Self
Creates a reliability analysis from an MRR fitting result.
§Panics
This function does not panic. MRR results always have valid parameters.
Sourcepub fn reliability(&self, t: f64) -> f64
pub fn reliability(&self, t: f64) -> f64
Reliability (survival) function at time t.
R(t) = exp(-(t/eta)^beta)For t < 0, returns 1.0 (no failure before time 0).
§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
// R(0) = 1.0 (full reliability at time zero)
assert!((ra.reliability(0.0) - 1.0).abs() < 1e-10);
// R(eta) = exp(-1) ≈ 0.368 for any shape parameter
let expected = (-1.0_f64).exp();
assert!((ra.reliability(100.0) - expected).abs() < 1e-10);§Reference
Weibull (1951), Journal of Applied Mechanics 18(3), pp. 293-297.
Sourcepub fn hazard_rate(&self, t: f64) -> f64
pub fn hazard_rate(&self, t: f64) -> f64
Failure rate (hazard function) at time t.
lambda(t) = (beta/eta) * (t/eta)^(beta-1)- beta < 1: Decreasing failure rate (infant mortality)
- beta = 1: Constant failure rate (random/exponential failures)
- beta > 1: Increasing failure rate (wear-out)
For t <= 0, returns 0.0.
§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
// Hazard rate is positive for t > 0
assert!(ra.hazard_rate(50.0) > 0.0);
// With beta > 1, hazard rate increases over time (wear-out)
assert!(ra.hazard_rate(50.0) < ra.hazard_rate(80.0));§Reference
Meeker & Escobar (1998), Statistical Methods for Reliability Data, Ch. 4.
Sourcepub fn mtbf(&self) -> f64
pub fn mtbf(&self) -> f64
Mean Time Between Failures (MTBF).
MTBF = eta * Gamma(1 + 1/beta)§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
let mtbf = ra.mtbf();
assert!(mtbf > 0.0);
// For beta=1 (exponential), MTBF = eta
let exp_ra = ReliabilityAnalysis::new(1.0, 50.0).unwrap();
assert!((exp_ra.mtbf() - 50.0).abs() < 1e-8);§Reference
Johnson, Kotz & Balakrishnan (1994), Continuous Univariate Distributions, Vol. 1, Chapter 21.
Sourcepub fn time_to_reliability(&self, p: f64) -> Option<f64>
pub fn time_to_reliability(&self, p: f64) -> Option<f64>
Sourcepub fn b_life(&self, fraction_failed: f64) -> Option<f64>
pub fn b_life(&self, fraction_failed: f64) -> Option<f64>
B-life: time at which a given fraction of the population has failed.
B10 life (10% failed) = b_life(0.10), which is equivalent to
time_to_reliability(0.90).
§Arguments
fraction_failed- Fraction of population that has failed, must be in (0, 1).
§Returns
None if fraction_failed is outside (0, 1).
§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
// B10: time when 10% of the population has failed
let b10 = ra.b_life(0.10).unwrap();
assert!(b10 > 0.0 && b10 < 100.0);
// B-lives increase with failure fraction: B5 < B10 < B50
let b5 = ra.b_life(0.05).unwrap();
let b50 = ra.b_life(0.50).unwrap();
assert!(b5 < b10 && b10 < b50);§Reference
Abernethy (2006), The New Weibull Handbook, 5th ed., Chapter 2.
Trait Implementations§
Source§impl Clone for ReliabilityAnalysis
impl Clone for ReliabilityAnalysis
Source§fn clone(&self) -> ReliabilityAnalysis
fn clone(&self) -> ReliabilityAnalysis
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more