# Have you ever had to prepare an Xbar and R chart?

If so, you most likely used some type of software package to display your data and compute the necessary control limits for your Xbar and R chart. But, have you ever wondered how these control limits for an Xbar and R chart were computed?

For those of you that had to perform the calculations by hand, chances are you applied Xbar and R chart formulas using various control chart constants. I know I did! I recall looking up values for A_{2} and D_{4} without any idea where they came from.

The truth is; computing control limits isn’t that complicated. And, while the control chart constants used to compute control limits appears to be a mystery, they are quite easy to understand and derive.

In this article, I’ll show you how to derive the following constants: d_{2}, d_{3}, A_{2}, D_{3}, and D_{4}. I’ll also show you how to use them to compute control limits for the Xbar and R chart. And it’s not that complicated. Knowing where these constants come from and how you can derive them through simple simulations will improve your knowledge and deepen your appreciation of statistical process control. After you go through this article, you’ll be building Xbar and R charts with easy and confidence!

### It all starts with this chart…

**The Range Chart**

To build control limits for a Range chart we need to estimate the standard deviation, σ. We can estimate σ from m subgroups taken from a process. Each subgroup is a collection of n samples made under like conditions. To assure we collect n samples made under like conditions, we collect consecutive samples over a short period of time. Doing so assures the conditions that produced the first sample are likely the same for the remaining n-1 samples. As such, the data that describes a feature derived from n like samples estimates common cause variation.

For each subgroup we compute the range and plot those values on the Range chart. The Range is the smallest value subtracted from the largest value in a subgroup. To estimate the standard deviation (σ) we compute the average Range across m subgroups and divide by a correction factor, called d_{2}. In this article, I’ll focus on the range method and illustrate how we can derive the constants: d_{2}, d_{3}, D_{3} and D_{4} used to compute the control limits for a Range chart.

### Let’s talk about the basics…

**1.0 Computing the Range**

Let’s say that x_{1}, x_{2},…, x_{n} describes a single value, of a part feature, from n samples. To compute the range, we take the difference between the largest and smallest value as shown in the expression below.

R = x_{max} – x_{min}

### This next part is critical!

**2.0 Computing d**_{2} and d_{3} using the Relative Range, W

_{2}and d

_{3}using the Relative Range, W

In statistics, there is a relationship between the range of a sample, from a normal distribution, and the standard deviation of that distribution. We can describe that relationship as a random variable W = R / σ. We call this variable (W) the Relative Range. The parameters of the distribution of W (mean and standard deviation) are a function of the sample size n. The mean and standard deviation of W is d_{2} and d_{3}. As such, an estimator of the standard deviation is s = R/d_{2}. In Table 1, shown are the values of d_{2} for the samples sizes n = 2, 3, 4, 5, 6, and 7.

Shown in Figure 1 is a simulation of 10 million distributed range values for n=5. I used normally distributed values having a mean and standard deviation of 0 and 1 to compute the range. The mean of the distribution of range values is d_{2} and the standard deviation is d_{3}. In this case, d_{2} = 2.326 and d_{3} = 0.864.

Refer to the following post, **Range Statistics**. It explains, in further detail, how to estimate the d_{2} constant and use it to compute the standard deviation.

### Let’s put what we learned into practice!

**3.0 Computing the Average Range, , and standard deviation, s.**

If R_{1}, R_{2},…,R_{M} represent the range for each sample, then we can find the average range using the following expression.

To compute the average range, we sum the ranges (R_{i}) and divide by the number of subgroups (m).

Now that we have the average range () we can estimate the standard deviation, σ. To do so, we will estimate the standard deviation by rearranging the Relative Range. Since W = R/σ, then σ = R/W. We can estimate σ using the standard deviation, s. We can estimate the Range (R) using the average Range (_{2}).

### How accurate is the Average Range ( )?

**4.0 The Relative Efficiency of the Range to estimate the variance, s**^{2}.

^{2}.

For small samples sizes between n = 2 through n = 6, the range method provides a good estimate of the sample variance s^{2}. In table 2, I show the relative efficiency of the range method to estimate the variance, s^{2}. Beyond n = 6 samples per subgroup, the relative efficiency deteriorates. This is especially true after n = 10 samples per subgroup. But, for small samples sizes, say n = 2 to n = 5 the relative efficiency is good and satisfactory.

### Let’s derive and compute the control limits!

**5.0 Computing control limits about the subgroup averages**

If we use

We call UCL and LCL upper and lower control limits. To compute the control limits for the

**6.0 The A**_{2} Constant

_{2}Constant

As mention earlier,

The A_{2} constant only depends on the subgroup same size n. Using A_{2} we can rewrite the control limit expressions as follows.

The constant A_{2} is tabulated for various sample sizes in Table 3.

**7.0 Computing the Upper and Lower Control Limits for the Ranges – Deriving D**_{3} & D_{4}

_{3}& D

_{4}

So far, we have shown that the subgroup range relates to the process standard deviation. It is thus possible to observe process variability by plotting the subgroup Range values. For this reason we call this type of plot a ** Range Chart**. The parameters of the Range Chart are easily found. The average Range,

_{3}, is a known function of n. Let’s rearrange the Relative Range, W, and express it as a function of the Range, R.

**R = Wσ**

The standard deviation of the range is:

Since σ is unknown, we may estimate using:

Now that we have an estimate of the standard deviation of the Ranges we can compute the 3-sigma control limits using these expressions.

We can simplify these expressions by making the following substitution.

and

Substituting D_{3} and D_{4} into the control limit expression we have,

In Table 4, the constants D_{3} and D_{4} are shown for subgroup sample sizes n.

When we use few subgroups to construct a X-bar and Range chart, we often consider these as trial control limits. In such a case, we still plot the subgroup averages and ranges on the control chart. The series of subgroup average and range values should display a random pattern. That is, there should not be evidence to suggest special cause variation. We observe special cause variation if any value falls beyond the control limits or when a consecutive values form a trend. When we notice such special cause events, we should investigate. If these special cause events have an assignable cause, we should remove those values and use new trial control limits.

### Here’s the best part! An Xbar and R Chart Case Study!

**8.0 Xbar and R Chart Case Study**

A metal stamping press makes metal parts used in automotive seating. A manufacturing Engineer wishes to establish statistical control of a critical feature; hole diameter. The Engineer collects twenty-five subgroups (m=25). Each subgroup contains n=5 consecutive samples collected each hour. The data appears in Table 4. Using this data, we will compute the control limits and display an Xbar and R chart.

When working with an Xbar and R chart, we begin with the R chart. The control limits for the chart depends on the process variability,

For n=5 sample per subgroup, we find that D_{3 }= 0 and D_{4 }= 2.115. Therefore, the control limits for the R chart are:

The 25 sample range values along with the centerline and upper control limit appear in the Range chart shown in Figure 2. The Range chart does not reveal any out-of-control condition. As such, the range chart suggests the process variability is stable and in control. Based on this observation we will use

To build the

To compute the control limits for the _{2} = 0.577 from Table 3 for a subgroup sample size of n=5.

Shown in Figure 3 is the

### Now!

This article provides a foundation readers can use to derive and build their own Xbar and R chart. I showed how we can derive the Xbar and R chart constants, d_{2} and d_{3},through simulation and used those constants to compute control limits for the Xbar and Range chart.

In our example, we computed trial control limits that we will use to check a process with time. From time to time, the Xbar and R chart will not exhibit control. When the Xbar and R chart does not exhibit control we will need to identify special cause events. Finding special cause events is a critical practice. It demands that we determine when such an event started, how long it lasted, and what type of special cause variation is at work. Knowing the type of variation, when it started, and how long it lasted helps isolate a potential root cause. Identifying a potential root cause drives continuous improvement. This, we will discuss in a follow-up article.

For additional information, on the Xbar and R Chart, please refer to the following **website **.

### It’s your turn!

I enjoy hearing from my readings. If you liked this article on the Xbar and R chart or have questions about the Xbar and R chart then I would like to hear from you.

Thank you, Andrew. It brings memories 🙂

Your very welcome!

Best regards,

Andrew

Hi,

how to calculate A2 factor for sample n =45, after UCL, LCL calculation how these values shall be used to control with reduced sampling n=20. pls help me.

Hello Amuthan.

A2 is a function of the subgroup sample size. In your case if the subgroup sample is n = 45 and you plan to eventually reduce that sample size to n=20. i would not use an Xbar and Range chart. Instead I would recommend the Xbar and S chart.

Using the Range to estimate within subgroup variation deteriorates as n gets large (ie. n > 10) so the Xbar and S chart is better suited. For this type of control chart, the equivalent A2 estimate to compute the control limits for the Xbar Chart uses the C4 constant instead of d2 constant.

Thank you for asking this question. I hope to write another article that discusses the Xbar and S Chart.

Best Regards,

Andrew

Hi Andrew,

Thanks for great article.

1. How far inaccurate of sample size 9 and 10 in comparison to sample seize 5pcs in XbarR chart?

2. What is the best sample size to get accurate XbarS chart?

3. What is the best sample sub group numbers in order to get good picture of process in XbarR and XbarS control chart?

4. Appreciate if you can share link with example of using XbarR and XbarS chart in manufacturing.

Regards, Anton

Hello Antonius.

Thanks for posting your thoughtful questions.

I am currently writing a NEW post that will address your questions.

Please stay tuned.

Hello Anton.

I published a post in response to your questions above. You can access that post by following this link: https://andrewmilivojevich.com/xbar-r-chart-versus-xbar-s-chart/

Andrew,

Do you have any suggestion or best practice in taking samples for getting as accurate as possible control chart.

I am working at wood flooring and plywood industry.

Many thanks in advance.

Anton

How can we get the value of A2, D3 & D4 if the sub group size is more than 50?

X BAR AND R VALUES FOR THE 10 SAMPLES OF TEA CONTAINING 30 PACKETS

X Bar: 320 310 330 360 290 280 340 320 360 300

R : 12 16 14 18 22 23 10 13 27 25

A packaging machine packs tea in plastic packets. To ensure consistent quantity in each packet a sample of 30 packets were taken per hour in a day and its mean and range is recorded. Around 10 such sample were taken per day. From the following data answer the following questions.

Q.No 1: Comment on the type of data being collected, which control chart is appropriate for the data and why.

Q.No 2: what are the values for Central Line, Upper control limit and lower control limit, also show the entire calculations for the response

Can you please let me know if I should employ an Xbar and R chart t- OR – Xbar and S chart.

Hello Rajveer.

It appears that you have 10 subgroups where each subgroup contains 30 observations. Can you please confirm this?

Secondly, what does the average represent? I am unclear as to what feature of the ‘tea’ is being measured.