PChart Class

A v2 SPC chart for monitoring the fraction of nonconforming items per subgroup (P chart). Supports both variable and constant sample sizes. Implements the full Unfitted → Fitted → Deployed → Apply lifecycle defined by ControlChart.

Definition

Namespace: Numerics.NET.Statistics.ProcessControl
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.4.0
C#
public sealed class PChart : ControlChart<PChart>
Inheritance
Object  →  ControlChart  →  ControlChart<PChart>  →  PChart

Remarks

The P chart is used when the fraction of nonconforming items per subgroup is being monitored. When sample sizes vary, each subgroup has its own control limits; when the sample size is constant, the limits are identical across all subgroups.

Use the Series property to access the result series. It returns a PointwiseLimitSeries when variable sample sizes produce per-point limits, or a FixedLimitSeries when a constant sample size was used.

Typical usage (variable sizes):

C#
double[] counts = { 2, 3, 1, 4, 2 };
double[] sizes  = { 50, 60, 40, 55, 45 };

// Phase I — establish limits
PChart chart = new PChart(Vector.Create(counts), Vector.Create(sizes));
chart.Analyze();

// Deploy for production monitoring
PChart deployed = (PChart)chart.Deploy();

// Phase II — apply to new data with new sample sizes
double[] newCounts = { 1, 2, 3 };
double[] newSizes  = { 50, 55, 60 };
PChart applied = deployed.Apply(
    Vector.Create(newCounts), Vector.Create(newSizes));

Constructors

PChart(Vector<Double>, Vector<Double>, IIndex) Initializes a new PChart in the Unfitted state from vectors of nonconforming counts and variable sample sizes.
PChart(Vector<Double>, Double, IIndex) Initializes a new PChart in the Unfitted state from a vector of nonconforming counts and a single constant sample size. When the sample size is constant the control limits are identical across all subgroups.

Properties

HasVariableSizes Gets a value indicating whether this chart was constructed with variable sample sizes. When true, cast Series to PointwiseLimitSeries; when false, cast to FixedLimitSeries.
PooledFractionNonconforming Gets the pooled fraction nonconforming (p̄) computed during phase-I analysis, which serves as the chart center line.
SampleSizes Gets the sample sizes used during phase-I analysis when the chart was constructed with variable sample sizes.
Series Gets the P chart data series. Returns a PointwiseLimitSeries when variable sample sizes produce per-point limits, or a FixedLimitSeries when a constant sample size was used.
State Gets the current lifecycle state of this chart.
(Inherited from ControlChart)

Methods

Analyze Performs phase-I analysis, establishing control limits and transitioning the chart from Unfitted to Fitted.
(Inherited from ControlChart)
Apply(Vector<Double>) Applies new observations to this Deployed chart and returns a new TChart in the Fitted state.
(Inherited from ControlChart<TChart>)
Apply(Vector<Double>, Vector<Double>) Applies new observations to this Deployed chart with variable sample sizes and returns a new PChart in the Fitted state.
CreateDeployedFixed Creates a constant-size PChart directly in the Deployed state from externally supplied fitted parameters.
CreateDeployedVariable Creates a variable-size PChart directly in the Deployed state from the pooled fraction nonconforming. The chart is ready to accept new data via Apply(Vector<Double>, Vector<Double>).
Deploy Creates a new TChart in the Deployed state from this Fitted chart.
(Inherited from ControlChart<TChart>)
Diagnose Produces a diagnostic report for the current chart state.
(Inherited from ControlChart)
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FromJson Reconstructs a PChart from a JSON string previously produced by ToJson().
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
ToJson Serializes this PChart to a JSON string.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also