# p Control Chart – Online App

• /
• Blog
• /
• p Control Chart – Online App

A p Chart, or proportion control chart, is a statistical tool used to monitor the quality of a process by assessing the proportion of nonconforming items in a sample. This method is particularly useful when working with equal or unequal sample sizes. In this blog post, we'll discuss the formula for p Charts and provide a step-by-step guide on how to use our p Chart web app.

## The p Chart Formula

To construct a p Chart, we first need to calculate the proportion of nonconforming items for each sample (p) using the formula:

p = Number of Nonconforming Items / Sample Size

Next, we calculate the overall average proportion (p-bar) across all samples:

p-bar = Total Number of Nonconforming Items / Total Sample Size

The centerline of the p Chart is the average proportion (p-bar). The upper control limit (UCL) and lower control limit (LCL) are calculated as follows:

UCL = p-bar + 3 * √(p-bar * (1 - p-bar) / Sample Size)

LCL = p-bar - 3 * √(p-bar * (1 - p-bar) / Sample Size)

Note: If the LCL is less than 0, it is set to 0.

## How to Use the p Chart Web App?

1. Open the p Chart web app.
2. Input your data: The app requires a two-column dataset with a header row. The first column should contain the sample sizes, and the second column should contain the number of nonconforming items in each sample. Copy and paste your data into the text box provided, using a tab-separated format.
3. Click the "Draw Control Chart" button: The app will generate the p Chart, displaying the data points, centerline, UCL, and LCL. Points within the control limits will be shown as blue circles, while points outside the limits will be represented by red squares.
4. Interpret the results: If all the points fall within the control limits, the process is considered stable and in control. However, if any points fall outside the limits, the process may be out of control, indicating the presence of special-cause variation. In this case, further investigation is necessary to identify and eliminate the cause.

## p Control Chart Online App:

### p Control Chart

``` function processData(textData) { const lines = textData.trim().split('\n'); const data = lines.slice(1).map(line => line.split('\t').map(Number)); return { header: lines, data: data }; } function drawControlChart() { const textData = document.getElementById('data-input').value; const { header, data } = processData(textData); const sampleSizes = data.map(row => row); const defectiveItems = data.map(row => row); const totalDefectives = defectiveItems.reduce((acc, val) => acc + val, 0); const totalSampleSize = sampleSizes.reduce((acc, val) => acc + val, 0); const averageProportion = totalDefectives / totalSampleSize; const proportions = defectiveItems.map((defectives, index) => defectives / sampleSizes[index]); const centerLine = averageProportion; const ucl = proportions.map((_, index) => centerLine + 3 * Math.sqrt(centerLine * (1 - centerLine) / sampleSizes[index])); const lcl = proportions.map((_, index) => Math.max(centerLine - 3 * Math.sqrt(centerLine * (1 - centerLine) / sampleSizes[index]), 0)); drawPChart(header, proportions, centerLine, ucl, lcl); document.getElementById('p-chart-stats').innerHTML = `p Chart - Mean: \${centerLine.toFixed(2)}`; } function drawPChart(header, data, centerLine, ucl, lcl) { const traceData = { x: data.map((_, index) => index + 1), y: data, mode: 'lines+markers', name: 'Data', marker: { color: data.map((value, index) => (value >= lcl[index] && value <= ucl[index]) ? 'blue' : 'red'), size: 8, symbol: data.map((value, index) => (value >= lcl[index] && value <= ucl[index]) ? 'circle' : 'square') }, line: { color: 'blue' }, showlegend: false }; const traceUCL = { x: data.map((_, index) => index + 1), y: ucl, mode: 'lines', name: 'UCL', line: { color: 'red', width: 2, dash: 'dash' } }; const traceLCL = { x: data.map((_, index) => index + 1), y: lcl, mode: 'lines', name: 'LCL', line: { color: 'red', width: 2, dash: 'dash' } }; const traceCenterLine = { x: [0, data.length], y: [centerLine, centerLine], mode: 'lines', name: 'Mean', line: { color: 'grey', width: 2 } }; const layout = { title: `\${header} - p Chart`, xaxis: { title: 'Sample Number' }, yaxis: { title: header } }; Plotly.newPlot('p-chart', [traceData, traceUCL, traceLCL, traceCenterLine], layout); } const defaultData = "Sample Size\tNumber of Defectives\n50\t3\n50\t4\n60\t2\n50\t3\n50\t1\n50\t2\n70\t3\n50\t2\n50\t4\n50\t2"; document.getElementById("data-input").value = defaultData; drawControlChart(); ```

## Conclusion

p Charts are an essential tool for monitoring process quality and identifying areas for improvement. By using our web app, you can easily create p Charts and gain insights into the performance of your processes.

Posted on April 16, 2023 by  Quality Gurus

Similar Posts:

January 20, 2022

## Unacceptable Corrective Actions

Unacceptable Corrective Actions

July 19, 2022

Data Automation

January 22, 2018

## ASQ® Certified Supplier Quality Professional – CSQP

ASQ® Certified Supplier Quality Professional – CSQP

32 Courses on SALE!