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

§Reference

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

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 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.

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.

Trait Implementations§

Source§

impl Clone for ReliabilityAnalysis

Source§

fn clone(&self) -> ReliabilityAnalysis

Returns a duplicate of the value. Read more
1.0.0 · 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V