The Math Behind The Process Behavior Chart

Ever since asking Is SPC Obsolete? on this blog almost 6 years ago, multiple sources have told me that the XmR chart is a wonderful and currently useful process behavior chart, universally applicable, a data analysis panacea, requiring no assumption on the structure of the monitored variables. So I dug into it and this what I found.

What’s an XmR chart?

Here is an example of what these charts look like:

The X chart and the mR chart

The top chart shows individual measurements over time; the bottom one, a moving range based on the last two values. What makes this more than a plain times series charts — the likes of which are found in as unsophisticated a publication as USA Today — is the red dashed lines marking control limits.

Misleading time series from USA Today

How control limits are set

The method for setting these limits is essential to the tool.

The Recipe

The limits are multiples of the average of the moving range \overline{mR} . What the literature tells you is that, for the chart of individual values, the limits are at:

Average \pm 2.66\times\overline{mR}

 

and for the range at

3.27\times\overline{mR}

 

Concerns about the formulas

The readers are discouraged from worrying their heads with the provenance of these numbers, and the closest they get to an explanation is a reference to a table where such coefficients are kept, and this table was generated by a higher authority. No further explanation is found in the books I have seen by Douglas Montgomery, J.M. Juran, or Don Wheeler.

The assertion that these numbers are valid regardless of the data’s variation pattern strains credulity. Clearly, they did not come out of thin air. There is a theory behind them, that theory is based on assumptions about the data, and it is necessary for users to know these assumptions so that they can understand the domain of applicability of the technique, with its blurry boundaries.

You may still get some use out of the technique when the conditions are not fully met but you should do so knowingly. As discussed in an earlier comment, chemical engineers commonly apply formulas for perfect gases to gases they know aren’t perfect.

The math of limit setting

Not finding this information for the XmR chart, I undertook to work it out myself, starting with the model implicit in the SPC literature, that a process variable X is the sum of a constant C with a white noise W. Formally, for the i-th measurement,

X_{i} = C + W_{i}

 

where the W_{i} are independent Gaussian (also known as “Normal”) variables with 0 mean and standard deviation σ. Let us consider the differences between consecutive variables  X_{i} and X_{i-1}:

X_{i} - X_{i-1} = W_{i} -W_{i-1}

 

As sums of two independent Gaussian variables with 0 mean and standard deviation σ, they are also Gaussian, with 0 mean and standard deviation \sqrt{2}\times\sigma . The range R_{i} is the absolute value of this difference:

R_{i} =  \left |X_{i} - X_{i-1} \right | = \left |W_{i} - W_{i-1} \right |

 

and follows the Half-Gaussian distribution. The mean \mu_{R} of the range is:

\mu_{R} = \sqrt{\frac{2}{\pi}}\times(\sqrt{2}\sigma) = \frac{2}{\sqrt{\pi}}\times\sigma

 

and therefore:

\sigma = \frac{\sqrt{\pi}}{2}\times\mu_{R} = 0.8862 \times\mu_{R}

 

which results in:

3\sigma = 2.66\times\mu_{R}

 

For the standard deviation  \sigma_{R} of the moving range, we have:

\sigma_{R}^{2 }= 2\sigma^{2} -\mu_{R}^{2} = \mu_{R}^{2}\times(\frac{\pi}{2} -1)

 

This means that, for R, the r\sigma_{R} upper control limit is:

\mu_{R} + 3\sigma_{R} = \mu_{R}\times\left (1 + 3\times\sqrt{\frac{\pi}{2} -1} \right ) = 3.27\times\mu_{R}

 

This derivation confirms that the published coefficients are based on the assumption that the monitored variable is Gaussian. Of course, it doesn’t prove it but it is highly unlikely that any other distribution would produce the exact same coefficients.

Interpretation

We need to consider the two charts separately.

The X chart

The X chart is simply a plot of the raw time series and, as long as the model X_{i} = C + W_{i} holds,  99.7% of the points will be within ±3σ of C. This is now commonly described as saying that the “p-value” of checking against these limits is 0.3%.

Generally, the p-value of a sample statistic is the probability that it will be outside its limits when all the data are generated from the reference model. P-values are often used today because they are more general and less arbitrary than levels of significance, and easy to calculate. A 95% level of significance means p=.05 and 99%, p=.01. Running multiple tests against the same data until you find one that gives you a “significant” difference is called p-hacking.

The mR chart

The p-value of the mR chart, however, is higher, meaning that it is more prone to false alarms. In terms of \sigma, the mR chart’s upper control limit is

3.27\times\mu_{R} = 3.69\sigma

 

and the standard deviation of the differences W_{i} - W_{i-1} is

\sigma_{D} =  \sqrt{2}\times\sigma

 

If we plug these numbers into the formula for the cumulative distribution function of the half-gaussian, we get:

p = 1- erf(\frac{3.69}{2}) = 1\%

 

As can be easily verified with simulations, this yields an average of 1 false alarm for every 100 points, which is three times more than the X chart. If the process is unstable, there are so many genuine alarms for the engineering team to investigate that false alarms won’t be a problem.

If, on the other hand, it is so stable that it never goes out of control, the chart will still generate alarms and they will all be false. After two or three cases of assembling a task force to chase non-existent assignable causes, management will lose confidence in the chart.

Don Wheeler’s reasons for plotting mR charts

XmR chart expert Don Wheeler offers the following, not-fully compelling reasons to plot mR charts:

  1. “The Moving Range Chart will, on occasion, provide new information in addition to reinforcing the message of the X Chart.”
  2. “Thus, the mR Chart is the secret handshake of those who know the correct way of computing limits for an X Chart. Omit it and your readers cannot be sure that you are a member of the club.”
  3. “The mR Chart allows you and your audience to check for the problem of chunky data. This is a problem that occurs when the data have been rounded to the point that the variation is lost in the round-off.”

New information?

The mR chart is indeed a summary of the X chart and, as such, may provide new information. The questions are whether it is worth the trouble to maintain it and whether there are no other tools from time series analysis to get the same information more easily.

Club membership

The point of visualizing and analyzing quality characteristics is to troubleshoot a process, not to secure the approval of others or prove membership in any club. The inventors of these techniques didn’t have professional societies looking over their shoulders and checking their work for conformity to standards. The same problems should be addressed in the same spirit today.

Chunky data

“Chunky data” is a real problem. I remember a case where operators had manually measured the thickness of a plate at its four corners, with calipers that gave four significant digits, which they had rounded to two. Unfortunately, the information we were looking for was in the digits they had rounded off. We didn’t, however, need an mR chart to find out. It was visible in the paper spreadsheet. The risk of this happening is almost entirely eliminated in automatic data acquisition from sensors, instruments, and IIoT devices.

#XmR, #SPC, #ProcessBehaviorChart