Skip to main content

Pert

Struct Pert 

Source
pub struct Pert { /* private fields */ }
Expand description

PERT distribution (Program Evaluation and Review Technique).

A modified Beta distribution defined by three points: optimistic (min), most likely (mode), and pessimistic (max).

§Mathematical Definition

Shape parameters (with λ = 4):

α = 1 + λ · (mode − min) / (max − min)
β = 1 + λ · (max − mode) / (max − min)

The underlying variable Y = (X − min)/(max − min) follows Beta(α, β).

  • Mean: (min + λ·mode + max) / (λ + 2) = (min + 4·mode + max) / 6
  • Std Dev (simplified): (max − min) / (λ + 2) = (max − min) / 6

§Exact vs Simplified Variance

The simplified variance ((max−min)/6)² is an approximation. The exact variance uses the Beta distribution formula:

Var = α·β / ((α+β)²·(α+β+1)) × (max−min)²

The simplified formula is exact when the distribution is symmetric (mode = midpoint) and becomes less accurate as skewness increases.

Reference: Malcolm et al. (1959), “Application of a Technique for Research and Development Program Evaluation”, Operations Research 7(5).

Implementations§

Source§

impl Pert

Source

pub fn new(min: f64, mode: f64, max: f64) -> Result<Self, DistributionError>

Creates a standard PERT distribution (λ = 4).

§Errors

Returns Err if min >= max or mode is outside [min, max].

Source

pub fn with_shape( min: f64, mode: f64, max: f64, lambda: f64, ) -> Result<Self, DistributionError>

Creates a modified PERT distribution with custom shape parameter λ.

λ controls the weight of the mode:

  • λ = 4: standard PERT
  • λ > 4: tighter distribution (more peaked)
  • λ < 4: flatter distribution (less peaked)
§Errors

Returns Err if parameters are invalid.

Source

pub fn min(&self) -> f64

Source

pub fn mode(&self) -> f64

Source

pub fn max(&self) -> f64

Source

pub fn alpha(&self) -> f64

Source

pub fn beta_param(&self) -> f64

Source

pub fn mean(&self) -> f64

Mean = (min + 4·mode + max) / 6 for standard PERT (λ=4).

General: (min + λ·mode + max) / (λ + 2).

Source

pub fn variance(&self) -> f64

Exact variance using Beta distribution formula.

Var = α·β / ((α+β)²·(α+β+1)) × (max−min)²
Source

pub fn std_dev(&self) -> f64

Standard deviation = √(variance).

Source

pub fn cdf(&self, x: f64) -> f64

CDF via regularized incomplete beta function approximation.

Uses a numerical approximation of the regularized incomplete beta function I_x(α, β).

Source

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

Approximate quantile using normal approximation.

Uses μ + σ·Φ⁻¹(p) with the exact PERT mean and std dev. This is an approximation; accuracy decreases for highly skewed PERTs.

Returns None if p is outside (0, 1).

Trait Implementations§

Source§

impl Clone for Pert

Source§

fn clone(&self) -> Pert

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 Pert

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Pert

Source§

fn eq(&self, other: &Pert) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Pert

Auto Trait Implementations§

§

impl Freeze for Pert

§

impl RefUnwindSafe for Pert

§

impl Send for Pert

§

impl Sync for Pert

§

impl Unpin for Pert

§

impl UnwindSafe for Pert

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