Skip to main content

ReliabilityAnalysis

Struct ReliabilityAnalysis 

Source
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);

§References

  • Meeker & Escobar (1998), Statistical Methods for Reliability Data, Wiley.
  • Nelson, W. (1982). Applied Life Data Analysis, Wiley. §2.
  • Lawless, J.F. (2003). Statistical Models and Methods for Lifetime Data, 2nd ed.

Implementations§

Source§

impl ReliabilityAnalysis

Source

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());
Source

pub fn with_covariance(self, covariance: [[f64; 2]; 2]) -> Option<Self>

The same analysis with the covariance of the estimated (shape, scale) – row and column order shape, scale, as WeibullMleResult::covariance gives it – so the B-lives and reliabilities carry confidence intervals (Self::b_life_interval, Self::reliability_interval).

None unless the matrix is a covariance: finite, symmetric (to a relative 1e-9) and positive definite.

§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0).unwrap();
assert!(ra.clone().with_covariance([[0.04, 0.1], [0.1, 25.0]]).is_some());
assert!(ra.with_covariance([[0.04, 2.0], [2.0, 25.0]]).is_none()); // not positive definite
Source

pub fn covariance(&self) -> Option<[[f64; 2]; 2]>

The covariance of (shape, scale) the intervals are made from, when there is one.

Source

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.

The fit’s covariance comes along, so the analysis gives confidence intervals.

Source

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.

Source

pub fn shape(&self) -> f64

Returns the shape parameter (beta).

Source

pub fn scale(&self) -> f64

Returns the scale parameter (eta).

Source

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.

Source

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.

Source

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.

Source

pub fn time_to_reliability(&self, p: f64) -> Option<f64>

Time at which reliability drops to a given level.

Solves R(t) = p for t:

t = eta * (-ln(p))^(1/beta)
§Arguments
  • p - Desired reliability level, must be in (0, 1).
§Returns

None if p is outside (0, 1).

§Reference

Abernethy (2006), The New Weibull Handbook, 5th ed.

Source

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.

Source

pub fn b_life_interval( &self, fraction_failed: f64, confidence: f64, ) -> Option<(f64, WeibullInterval)>

The B-life at fraction_failed with its two-sided interval at confidence, by the delta method on ln t_p = ln η + ln(−ln(1 − p)) / β (normal on the log scale, so the limits stay positive).

Returns (estimate, interval); None without a covariance (Self::with_covariance, Self::from_mle) or when either argument is outside (0, 1).

§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0)
    .unwrap()
    .with_covariance([[0.04, 0.1], [0.1, 25.0]])
    .unwrap();
let (b10, ci) = ra.b_life_interval(0.10, 0.90).unwrap();
assert!(ci.lower < b10 && b10 < ci.upper);
§Reference

Meeker & Escobar (1998), Statistical Methods for Reliability Data, §8.4.

Source

pub fn reliability_interval( &self, t: f64, confidence: f64, ) -> Option<(f64, WeibullInterval)>

The reliability R(t) with its two-sided interval at confidence, by the delta method on u = ln(−ln R(t)) = β (ln t − ln η), which is unbounded – so the limits exp(−exp(u ± z·se)) stay inside (0, 1). At t ≤ 0 the model has no failures and the interval is [1, 1].

Returns (estimate, interval); None without a covariance or when confidence is outside (0, 1) or t is not finite.

§Examples
use u_analytics::weibull::ReliabilityAnalysis;
let ra = ReliabilityAnalysis::new(2.0, 100.0)
    .unwrap()
    .with_covariance([[0.04, 0.1], [0.1, 25.0]])
    .unwrap();
let (r, ci) = ra.reliability_interval(50.0, 0.95).unwrap();
assert!(0.0 < ci.lower && ci.lower < r && r < ci.upper && ci.upper < 1.0);
§Reference

Meeker & Escobar (1998), Statistical Methods for Reliability Data, §8.4.

Trait Implementations§

Source§

impl Clone for ReliabilityAnalysis

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReliabilityAnalysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.