## Have you ever had to prepare an Average and Range 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 () and the value of W which is the mean of the distribution of ranges (d_{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 as an estimator of μ and as an estimator of σ, then the parameters of the chart are:

We call UCL and LCL upper and lower control limits. To compute the control limits for the chart we use as an estimate of the process center (or mean) μ. Here is the average of the m subgroup averages. For a process operating in control we expect that each new subgroup, m+1, will have an average that falls within .

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

_{2}Constant

As mention earlier, , is the average across all m subgroup averages and represents the process centre. To simplify the control limit expressions (UCL, LCL) we make the following substitution:

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, , is the centreline. To determine the upper and lower control limits about, , we need an estimator of the standard deviation of the Ranges. Recall that we found the standard deviation of the distribution of range values for n=5 in figure 1. Note that we can find the standard deviation of the Ranges from the distribution of the Relative Range (W = R/σ). The standard deviation of W, called d

_{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.

### The Range (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, . If the Range chart is not in control, the control limits for the chart will have no meaning. Once we compute the control limits for the Range chart, we will study the range chart for control. Using the data from Table 4, we will compute the center line for the R chart.

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 compute the control limits for the chart.

To build the chart, we will use the data from Table 4.

### Computing the Control Limits for the Xbar Chart

To compute the control limits for the chart we will use A_{2} = 0.577 from Table 3 for a subgroup sample size of n=5.

Shown in Figure 3 is the chart. When we plot the 25 sample subgroup averages on this chart, the plot does not reveal any out-of-control conditions. We therefore conclude the Xbar and Range charts exhibit control. Going forward, we will adopt these trial control limits for use in online statistical process control.

### 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 **.

**If you are interested is seeing how you can visualize and estimate the d2 and d3 constants then watch the video below!**

**If you are interested is seeing how you can visualize and estimate the d2 and d3 constants then watch the video below!**

### It’s your turn!

I enjoy hearing from my readers, therefore, if you have any questions about the Xbar and R chart then I’d like to hear from you. In the meantime, are you interested in learning more about various topics in statistical process Control? Then consider readings these blog posts: **How to calculate statistical process control limits,** **Control chart constants – How to derive A2 and E2**, and **Estimating the d2 constant and the d3 constant using Minitab.**

Premkumar says

Can you pls Help to understand the below differences in the R bar value between manual method and Minitab Output.

Below is the data with Sub group size 5 and no. of Sub groups 10.

Calculated R bar using the formula (sum of Ri/M) = 3.18 and for the same data when checked in Minitab output is shows as Rbar = 3.245.

Not able to understand why this difference can you pls help.

601.6

600.4

598.4

600

596.8

602.8

600.8

603.6

604.2

602.4

598.4

599.6

603.4

600.6

598.4

598.2

602

599.4

599.4

600.8

600.8

598.6

600

600.4

600.8

600.8

597.2

600.4

599.8

596.4

600.4

598.2

598.6

599.6

599

598.2

599.4

599.4

600.2

599

599.4

598

597.6

598

597.6

601.2

599

600.4

600.6

599

Andrew Milivojevich says

In Minitab select,

Stat>Control Charts>Variable Charts for Subgroups > Xbar-R.

Click on ‘Xbar-R Options…’ then click on ESTIMATE in the menu and select Rbar as your estimate NOT Pooled

Standard Deviation.

By selecting Rbar as your estimate, the Control Chart R-Bar value will be the same as your calculated value by hand.

Premkumar says

Thanks a Lot for your valuable Input. I got this now.

Also can you pls guide how to calculate the Sigma value for the same data using Pooled Standard Deviation method in a manual way.

Andrew Milivojevich says

Hello I’ll let you know shorting – stay tuned.

Raghupathy Premkumar says

Thanks a Lot

Andrew Milivojevich says

Hello Raghupathy – I apologize but I haven’t had a chance to answer your question. Once things get back to normal, I will seek to reply to your question.

Premkumar says

Thanks a Lot a lot for your Quick Reply this relay helps.

Also can you pls also guide how to calculate the Process Sigma Using the pooled standard deviation method for the same data.

Andrew Milivojevich says

Sure – give me a little time and I will repost here.

AJAY S says

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.

Q.No 3: What are your interpretations for the above samples, can we accept that the system is in control,give justification for you answer.

Can you please solve this with explanation.

Andrew Milivojevich says

Hello Ajay.

I am amazed at how many times I get this same question!

So, lets deal with question 1. Which control chart is appropriate?

When the subgroup sample size is n=30 then the appropriate control chart is the Xbar and S Chart. To understand why, please read my blog post on this topic.

Now, let me comment on the last sentence of this question…..Around 10 such sample were taken per day. I do not like how this part of the question is worded. I would like to suggest that it should be worded like this…. Ten subgroups were collected per day.

Since there were ten Xbar values then why would we say ‘around’ 10 were collected per day? Also, samples refer to units that make up a logical subgroup. So when the question states 10 such sample were taken per day that could be interpreted to mean that each subgroup contains 10 samples. BUT, the question begins by saying that 30 packets were taken per hour so this implies that there are 30 consecutive samples per subgroup – very confusing.

So my recommendation is to please rewrite the question so that its interpretation is clear.

As for question no. 2 and 3. I would not compute control limits based on Range Values where each range value is the difference based on n=30 samples. Please refer to my blog post on Xbar Charts. In that blog post, I illustrate how that the efficiency of the Range decreases as the subgroup sample size increases. As such, the calculation of the control limits based on the Range when n=30 is suspect.

Best Regards,

Andrew

David Stockwell says

Excellent article, better (and more clear) than many industry documents I have seen. Thanks.

Also amused by the various Indian students (the Tea problem) that appear to want you to do their homework for them… To be sure, you are an excellent source for “the answers”.

Lucas says

Hi Andrew.

Very interesting article.

Quick question: The value of A2 Constant is something that you simply take from the table 4, Xbar and R Chart Constants; isn´t it?

Thanks in advance

Andrew Milivojevich says

Hello Lucas.

Yes, you can obtain the A2 constant from Table 4.

aqil says

Sir, this tea question is an assignment of a major college in India. However, without knowing the details of the individual samples collected it doesn’t seem possible to calculate the standard deviation. the above mentioned problem is complete as per the institution . Please enlighten.

Andrew Milivojevich says

Please refer to the clarification question posted earlier.

Prateek kansal says

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

And yes i have 10 subgroups with 30 observations. So it means n=10 and for that constant A2= 0.308 right??

Can i apply xbar r chart to this????

Andrew Milivojevich says

If I understand how the data was collected, I would not recommend the use of Rbar as an estimate.

In a previous post, I show how the R-bar is appropriate for 11 samples or less per subgroup.

In your question, each subgroup contains 30 samples. If this, in fact, the case – then I would use the Xbar and S chart.

Andrew Milivojevich says

Please refer to the clarification question I posted earlier.

Andrew Milivojevich says

The question implies that 30 samples where taken each hour for a total of 10 hours (where 10 hours = 1 day). If so, then each hour 30 consecutive samples were collected and the total sample size across 10 hours would be 10 x 30 = 300 samples. If this is correct, then we have 30 samples per subgroup. However, the last sentence implies that the total sample size is 30 across 10 subgroups – this implies each subgroup is n=3. So, does each Xbar represent the average of n=3 or n=30 samples? Once we answer this question, then I can have a more informed opinion to the question.

mithun says

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

Jhilimil Tea company has a packaging machine which pack 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 samples 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

Q.No 3: What are your interpretations for the above samples, can we accept that the system is in control, give justification for your answer

Andrew Milivojevich says

I addressed this in a reply to a the same question below.

ADIBA says

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 2: what are the values for Central Line, Upper control limit and lower control limit, also show the entire calculations for the response.

Q.No 3: What are your interpretations for the above samples, can we accept that the system is in control,give justification for you answer.

Can you please solve this with explanation.

Andrew Milivojevich says

I addressed this to a similar question below.

Alexandro Hernandez says

Thank you for taking the time to explain the details of the Xbar and R charts! One thing I’m unclear about is how to calculate the control limit of an R chart if RPD is being used. Would the limit be the average RPD of all the subgroup RPDs * D4 or is it the average RPD of all the subgroup RPDs + 3s (where s is the standard deviation of the average RPD)? Thank you for your time!

Andrew Milivojevich says

Hello Alexandro.

To compute the upper control limit for the Range chart, simply add the subgroup range values then divide by the number of subgroups to compute the average Range, Rbar. Then multiply Rbar by D4 to compute the upper control limit. The D4 constant contains an estimate of the standard deviation (s) multiplied by 3.

Best Regards,

Andrew Milivojevich

Rajveer says

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

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.

Andrew Milivojevich says

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.

Md. Alamgir says

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

Antonius says

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

Antonius says

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

Support User says

Hello Antonius.

Thanks for posting your thoughtful questions.

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

Please stay tuned.

Andrew Milivojevich says

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/

Amuthan says

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.

Andrew Milivojevich says

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

Boris Theodor says

Thank you, Andrew. It brings memories 🙂

Andrew Milivojevich says

Your very welcome!

Best regards,

Andrew