IMSL C# Programmer’s Guide
Quality Control and Improvement Charts >> PChart  Previous Page  Contents  Next Page

PChart

The PChart plots the proportion or fraction of defective products.

The production process is assumed to be stable and successive units are assumed independent. So each unit produced is a realization of a Bernoulli random variable with parameter p, the proportion defective.

The control limits are at

By default, p is proportion of defects observed in the data. To use a known p, set the attribute Center to p.

PChart Example

Defects in manufacturing of orange juice cans are measured. The number of defects in samples of 50 cans is counted (Montgomery 290).

The y-axis labels and the title on the control limits have been changed to use a percentage format.

(Download Code)
using Imsl.Chart2D;
using Imsl.Chart2D.QC;

public class SamplePChart : FrameChart {
    static int sampleSize = 50;
    static int[] numberDefects = {
        12, 15, 8, 10, 4, 7, 16, 9, 14, 10, 5, 6, 17, 12, 22, 8,
        10, 5, 13, 11, 20, 18, 24, 15, 9, 12, 7, 13, 9, 6
    };

    public SamplePChart() {
        Chart chart = this.Chart;
        AxisXY axis = new AxisXY(chart);
        PChart pchart = new PChart(axis, sampleSize, numberDefects);

        pchart.LowerControlLimit.SetTitle(“lcl = {0:0.00%}”);
        pchart.CenterLine.SetTitle(“center = {0:0.00%}”);
        pchart.UpperControlLimit.SetTitle(“ucl = {0:0.00%}”);

        axis.AxisX.AxisTitle.SetTitle(“Sample Number”);
        axis.AxisX.AxisLabel.TextFormat = “0”;
        axis.AxisY.AxisTitle.SetTitle(“Percent Defective”);
        axis.AxisY.AxisLabel.TextFormat = “P0”;
    }

    public static void Main(string[] argv) {
        System.Windows.Forms.Application.Run(new SamplePChart());
    }
}

PChartUnequal Example

In this example a PChart is computed with unequal sample sizes. The upper and lower control limits are now stair step lines (Montgomery 300).

The y-axis labels and the title on the center line have been changed to use a percentage format.

(Download Code)
using Imsl.Chart2D;
using Imsl.Chart2D.QC;

public class SamplePChartUnequal : FrameChart {
    static int[] sampleSize = {
        100, 80, 80, 100, 110, 110, 100, 100, 90, 90, 110, 120, 120,
        120, 110, 80, 80, 80, 90, 100, 100, 100, 100, 90, 90
    };
    static int[] numberDefects = {
        12, 8, 6, 9, 10, 12, 11, 16, 10, 6, 20, 15, 9, 8, 6, 8, 10,
        7, 5, 8, 5, 8, 10, 6, 9
    };

    public SamplePChartUnequal() {
        Chart chart = this.Chart;
        AxisXY axis = new AxisXY(chart);
        PChart pchart = new PChart(axis, sampleSize, numberDefects);

        pchart.CenterLine.SetTitle(“center = {0:0.00%}”);

        axis.AxisX.AxisTitle.SetTitle(“Sample Number”);
        axis.AxisX.AxisLabel.TextFormat = “0”;
        axis.AxisY.AxisTitle.SetTitle(“Percent Defective”);
        axis.AxisY.AxisLabel.TextFormat = “P0”;
        axis.AxisY.SetWindow(0.0, 0.2);
        axis.AxisY.AutoscaleInput = 0;
    }

    public static void Main(string[] argv) {
        System.Windows.Forms.Application.Run(
            new SamplePChartUnequal());
    }
}



©  Visual Numerics, Inc.  All rights reserved.  Previous Page  Contents  Next Page