# Xbar R Control Chart

• /
• Blog
• /
• Xbar R Control Chart

In the world of statistical process control, the X-bar R chart is a powerful tool used to monitor process stability and variability. It is used for continuous data, when individual measurements are collected in subgroups at regular intervals. This blog post will help you understand the basics of the X-bar R chart, learn the relevant formulas, get familiar with the constants table, and show you how to use our app to create your own X-bar R charts.

## X-bar R Chart Basics

The X-bar R chart is a combination of two charts – the X-bar chart and the R (Range) chart. The X-bar chart tracks the average of the measurements within each subgroup, while the R chart monitors the range or difference between the highest and lowest measurements in each subgroup.

The X-bar chart helps detect shifts in the process mean, and the R chart identifies changes in process variability. Together, they provide valuable insights into the process performance, enabling you to make data-driven decisions and maintain consistent product quality.

## Formula

The X-bar R chart uses the following formulas:

1. X-bar: The average of each subgroup X-bar = Σx / n
where Σx represents the sum of individual measurements within a subgroup and n is the subgroup size.
2. Range (R): The difference between the highest and lowest values in each subgroup R = max(x) - min(x)
3. Center Line (CL): The average of all X-bars CL = ΣX-bar / m
where m is the number of subgroups.
4. R-bar: The average range across all subgroups R-bar = ΣR / m
5. Control Limits: X-bar Chart:
• Upper Control Limit (UCL) = CL + (A2 × R-bar)
• Lower Control Limit (LCL) = CL - (A2 × R-bar)
6. R Chart:
• Upper Control Limit (UCL) = D4 × R-bar
• Lower Control Limit (LCL) = D3 × R-bar
7. where A2, D3, and D4 are control chart constants that depend on the subgroup size (n).

### Constants Table

To calculate the control limits, you'll need the appropriate constants. Here's a table of the constants for different subgroup sizes:

Subgroup Size (n)
A2
D3
D4
2
1.88
0
3.27
3
1.02
0
2.57
4
0.73
0
2.28
5
0.58
0
2.11
6
0.48
0.03
2.00
7
0.42
0.07
1.92
8
0.37
0.14
1.86
9
0.34
0.18
1.82

## Using the App

Our X-bar R chart app is designed to make it easy for you to create X-bar R charts from your data. Here's how to use it:

1. Input your data: Paste your Excel data into the app's input field. Your data should be formatted with the first column representing the subgroup number, and the following columns containing the measurements for each subgroup. The app will automatically detect the subgroup size based on the number of columns.
1. Data structure: Your data should be organized as follows:
``Subgroup Number | Measurement 1 | Measurement 2 | ... | Measurement n``

Make sure you separate the columns using tabs. Here's an example of a properly formatted dataset with a subgroup size of 5:

``1 97 101 102 98 100 ``2 99 100 101 102 101 ``3 100 101 102 99 98 ``4 101 99 100 102 103 ``5 100 100 101 99 98``
1. Draw the control charts: Click the "Draw Control Charts" button, and the app will generate the X-bar and R charts using your data. It will automatically calculate the centerlines and control limits based on the provided data and the appropriate constants from the table.
2. Interpret the results: Examine the generated charts for any points outside the control limits or non-random patterns, which may indicate a lack of process stability or the presence of special cause variation. If you find any out-of-control points, you can investigate the causes and take appropriate action to improve your process.

## XBar R Chart - Online App

### X-bar R Control Chart

``` const A2 = [0, 1.88, 1.02, 0.73, 0.58, 0.48, 0.42, 0.37, 0.34]; const D3 = [0, 0, 0, 0, 0, 0.03, 0.14, 0.18, 0.21]; const D4 = [0, 3.27, 2.57, 2.28, 2.11, 2.00, 1.92, 1.86, 1.82]; function processData(textData) { const lines = textData.trim().split('\n'); const data = lines.slice(1).map(line => line.split('\t').map(parseFloat)); const subgroupSize = data.length - 1; return { header: lines, data: data, subgroupSize: subgroupSize }; } function drawControlCharts() { const textData = document.getElementById('data-input').value; const { header, data, subgroupSize } = processData(textData); const subgroupAverages = data.map(row => row.slice(1).reduce((a, b) => a + b, 0) / subgroupSize); const subgroupRanges = data.map(row => Math.max(...row.slice(1)) - Math.min(...row.slice(1))); const xbarCenterLine = subgroupAverages.reduce((a, b) => a + b, 0) / subgroupAverages.length; const rCenterLine = subgroupRanges.reduce((a, b) => a + b, 0) / subgroupRanges.length; const xbarUCL = xbarCenterLine + A2[subgroupSize] * rCenterLine; const xbarLCL = Math.max(xbarCenterLine - A2[subgroupSize] * rCenterLine, 0); const rUCL = D4[subgroupSize] * rCenterLine; const rLCL = D3[subgroupSize] * rCenterLine; drawXbarChart(header, subgroupAverages, xbarCenterLine, xbarUCL, xbarLCL); drawRChart(subgroupRanges, rCenterLine, rUCL, rLCL); document.getElementById('xbar-chart-stats').innerHTML = `X-bar Chart - Mean: \${xbarCenterLine.toFixed(2)}, UCL: \${xbarUCL.toFixed(2)}, LCL: \${xbarLCL.toFixed(2)}`; document.getElementById('r-chart-stats').innerHTML = `R Chart - Mean: \${rCenterLine.toFixed(2)}, UCL: \${rUCL.toFixed(2)}, LCL: \${rLCL.toFixed(2)}`; } function drawXbarChart(header, subgroupAverages, centerLine, ucl, lcl) { const traceData = { x: subgroupAverages.map((_, index) => index + 1), y: subgroupAverages, mode: 'lines+markers', name: 'Data', marker: { color: 'blue', size: 8 }, line: { color: 'blue' }, showlegend: false }; const traceCenterLine = { x: [0, subgroupAverages.length], y: [centerLine, centerLine], mode: 'lines', name: 'Mean', line: { color: 'grey', width: 2 } }; const traceUCL = { x: [0, subgroupAverages.length], y: [ucl, ucl], mode: 'lines', name: 'UCL', line: { color: 'red', width: 2, dash: 'dash' } }; const traceLCL = { x: [0, subgroupAverages.length], y: [lcl, lcl], mode: 'lines', name: 'LCL', line: { color: 'red', width: 2, dash: 'dash' } }; const layout = { title: `\${header} - X-bar Chart`, xaxis: { title: 'Subgroup Number' }, yaxis: { title: header } }; Plotly.newPlot('xbar-chart', [traceData, traceCenterLine, traceUCL, traceLCL], layout); } function drawRChart(subgroupRanges, centerLine, ucl, lcl) { const traceData = { x: subgroupRanges.map((_, index) => index + 1), y: subgroupRanges, mode: 'lines+markers', name: 'Range', marker: { color: 'blue', size: 8 }, line: { color: 'blue' }, showlegend: false }; const traceCenterLine = { x: [0, subgroupRanges.length], y: [centerLine, centerLine], mode: 'lines', name: 'Mean', line: { color: 'grey', width: 2 } }; const traceUCL = { x: [0, subgroupRanges.length], y: [ucl, ucl], mode: 'lines', name: 'UCL', line: { color: 'red', width: 2, dash: 'dash' } }; const traceLCL = { x: [0, subgroupRanges.length], y: [lcl, lcl], mode: 'lines', name: 'LCL', line: { color: 'red', width: 2, dash: 'dash' } }; const layout = { title: 'Range Chart', xaxis: { title: 'Subgroup Number' }, yaxis: { title: 'Range' } }; Plotly.newPlot('r-chart', [traceData, traceCenterLine, traceUCL, traceLCL], layout); } ``` ``` const defaultData = "Shaft Diameter\n1\t97\t101\t96\t95\t98\n2\t99\t100\t102\t101\t100\n3\t100\t101\t97\t98\t99\n4\t101\t99\t100\t98\t97\n5\t100\t100\t101\t99\t98\n6\t98\t97\t96\t95\t94\n7\t99\t101\t100\t102\t103\n8\t100\t99\t98\t97\t96\n9\t97\t101\t99\t103\t102\n10\t98\t99\t100\t101\t102"; document.getElementById("data-input").value = defaultData; drawControlCharts(); ```

## Conclusion

The X-bar R chart is a valuable tool for monitoring process performance, enabling you to maintain a stable and consistent process. By understanding the formulas, using the constants table, and following the guidelines provided in this post, you can effectively utilize our app to create X-bar R charts for your own data. Start analyzing your process data today and unlock the benefits of data-driven decision-making!

Posted on April 17, 2023 by  Quality Gurus

Similar Posts:

November 28, 2021

## Types of Sampling

Types of Sampling

December 28, 2022

## Bernoulli Distribution

Bernoulli Distribution

November 25, 2021

## The Complete Guide to SMART Goals and How they are the Key to Achieving Success

The Complete Guide to SMART Goals and How they are the Key to Achieving Success

32 Courses on SALE!