pub struct PChart { /* private fields */ }Expand description
Proportion nonconforming (P) chart.
Monitors the fraction of defective items in samples that may have different sizes. Control limits vary per subgroup when sample sizes differ.
§Formulas
- CL = p-bar = total_defectives / total_inspected
- UCL_i = p-bar + 3 * sqrt(p-bar * (1 - p-bar) / n_i)
- LCL_i = max(0, p-bar - 3 * sqrt(p-bar * (1 - p-bar) / n_i))
§Examples
use u_analytics::spc::PChart;
let mut chart = PChart::new();
chart.add_sample(3, 100); // 3 defectives out of 100
chart.add_sample(5, 100);
chart.add_sample(2, 100);
chart.add_sample(4, 100);
let p_bar = chart.p_bar().expect("should have p_bar after adding samples");
assert!(p_bar > 0.0);§Reference
Montgomery, D.C. (2019). Introduction to Statistical Quality Control, 8th ed., Chapter 7, Section 7.3.
Implementations§
Source§impl PChart
impl PChart
Sourcepub fn add_sample(&mut self, defectives: u64, sample_size: u64)
pub fn add_sample(&mut self, defectives: u64, sample_size: u64)
Add a sample with the number of defective items and the total sample size.
Ignores samples where defectives > sample_size or sample_size == 0.
Sourcepub fn p_bar(&self) -> Option<f64>
pub fn p_bar(&self) -> Option<f64>
Get the overall proportion defective (p-bar), or None if no data.
Sourcepub fn is_in_control(&self) -> bool
pub fn is_in_control(&self) -> bool
Check if the process is in statistical control.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PChart
impl RefUnwindSafe for PChart
impl Send for PChart
impl Sync for PChart
impl Unpin for PChart
impl UnwindSafe for PChart
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more