Skip to main content

IndividualMRChart

Struct IndividualMRChart 

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

Individual and Moving Range (I-MR) control chart.

Monitors individual observations (subgroup size = 1) using the moving range of consecutive observations to estimate process variability.

§Algorithm

  1. Compute moving ranges: MR_i = |x_i - x_{i-1}| for i >= 1.
  2. Compute the mean of individual observations (X-bar) and the average moving range (MR-bar).
  3. I chart limits: CL = X-bar, UCL/LCL = X-bar +/- E2 * MR-bar.
  4. MR chart limits: CL = MR-bar, UCL = D4 * MR-bar, LCL = 0.

§Examples

use u_analytics::spc::{IndividualMRChart, ControlChart};

let mut chart = IndividualMRChart::new();
for &x in &[25.0, 25.2, 24.8, 25.1, 24.9, 25.3, 25.0, 24.7] {
    chart.add_sample(&[x]).unwrap();
}

let limits = chart.control_limits().expect("should have limits after 2+ observations");
assert!(limits.ucl > limits.cl);
assert!(limits.cl > limits.lcl);

§Reference

Montgomery, D.C. (2019). Introduction to Statistical Quality Control, 8th ed., Chapter 6: Control Charts for Variables.

Implementations§

Source§

impl IndividualMRChart

Source

pub fn with_rules(self, rules: RuleSet) -> Self

Apply only the given run tests when computing limits.

Defaults to RuleSet::shewhart – the 3-sigma test alone; the supplementary tests raise the false alarm rate and are asked for here. Existing points are re-evaluated, so the call may be made at any time.

§Examples
use u_analytics::spc::{IndividualMRChart, ControlChart, RuleSet, ViolationType};

let chart = IndividualMRChart::new()
    .with_rules(RuleSet::nelson().without(ViolationType::FourteenAlternating));
Source

pub fn rules(&self) -> RuleSet

The run tests this chart applies.

Source

pub fn new() -> Self

Create a new Individual-MR chart.

Source

pub fn sigma_hat(&self) -> Option<f64>

Short-term sigma estimated from this chart: sigma-hat = MR-bar / d2(2).

The moving range of consecutive observations is a range of two, so d2(2) = 2/sqrt(pi) is the unbiasing constant. This is the within sigma a capability study of individual observations uses, and the counterpart of XBarRChart::sigma_hat for subgroups of one.

Returns None if there is not enough data for control limits.

§Examples
use u_analytics::spc::{ControlChart, IndividualMRChart};

let mut chart = IndividualMRChart::new();
for x in [1.0, 3.0, 2.0] {
    chart.add_sample(&[x]).unwrap();
}
// MR-bar = (2 + 1) / 2 = 1.5
let sigma = chart.sigma_hat().expect("limits available");
assert!((sigma - 1.5 / (2.0 / std::f64::consts::PI.sqrt())).abs() < 1e-12);
Source

pub fn sigma_hat_df(&self) -> Option<f64>

Degrees of freedom of sigma_hat, for Cp/Cpk intervals: 0.62 (N - 1) for N observations. Successive moving ranges share a value, so they are not independent and no range-distribution formula applies; the factor is Wheeler’s empirical one (as JMP uses it).

Returns None if there is not enough data for control limits.

Source

pub fn mr_limits(&self) -> Option<ControlLimits>

Get the MR chart control limits, or None if insufficient data.

Source

pub fn mr_points(&self) -> &[ChartPoint]

Get the MR chart points.

Trait Implementations§

Source§

impl Clone for IndividualMRChart

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 ControlChart for IndividualMRChart

Source§

fn add_sample(&mut self, sample: &[f64]) -> Result<(), ControlChartError>

Add a single observation. The sample slice must contain exactly one element.

Source§

fn control_limits(&self) -> Option<ControlLimits>

Get the computed control limits, or None if insufficient data.
Source§

fn is_in_control(&self) -> bool

Check if the process is in statistical control. Read more
Source§

fn violations(&self) -> Vec<Violation>

Get all violations detected across all chart points.
Source§

fn points(&self) -> &[ChartPoint]

Get all chart points.
Source§

impl Debug for IndividualMRChart

Source§

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

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

impl Default for IndividualMRChart

Source§

fn default() -> Self

Returns the “default value” for a type. 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.