# EWMA Chart

The EWMA chart is an alternative to the Shewhart type control charts (XBar- R, XBar-Sigma and I-R charts in particular) and is most useful for detecting small shifts in the process mean. It uses a weighted moving average of previous values to “smooth” the incoming data, minimizing the affect of random noise on the process. It weights the current and most recent values more heavily than older values, allowing the control line to react faster than a simple MA (Moving Average) plot to changes in the process. Like the Shewhart charts, if the EWMA value exceeds the calculated control limits, the process is considered out of control. While it is usually used where the process uses 100% inspection and the sample subgroup size is 1 (same is the I-R chart), it can also be used when sample subgroup sizes are greater than one. . The example below shows a typical EWMA chart.

EWMA Chart – 1

The data used in the chart is pulled from the EWMA chart example, Table 9-1, in the textbook Introduction to Statistical Quality Control 7th Edition, by Douglas Montgomery.

.

Instead of comparing the actual sampled value of each interval to the current control limits, the EWMA chart calculates a stand-in value which is a weighed sum of current and past values. The formula for this calculation is:

$$Z_i = \lambda * X_i + (1.0-\lambda)*Z_{i-1}$$

The stand-in value for a give sample interval $$Z_i$$, is $$\lambda$$ times the current actual value $$X_i$$, and $$(1-\lambda)$$ the previously calculated stand-in value $$Z_{i-1}$$. The value $$\lambda$$ (lambda) is the smoothing factor for the calculation and has a permissible range of 0.0 to 1.0). The closer $$\lambda$$ is to 0.0, the more the affect of previous values get averaged into the current value. Conversely, the closer $$\lambda$$ is to 1.0, the smaller the smoothing effect. The literature recommends that $$\lambda$$ be within the range of 0.05 to 0.3.

When calculating the first sample interval at $$Z_i$$, there is no value for $$Z_{i-1}$$. So typically for the first sample interval this value (usually referred to as $$\mu_0$$) is assigned either a known process mean value, or the value of the mean for the current set of actual sample values. What you use will depend on what you have available.

The initial setup of the chart typically involves establishing standardized control UCL (Upper Control Limit) and LCL (Lower Control Limit), and Target (Centerline) values, for the EWMA chart. These limits are calculated based on monitoring and sampling the process when it is running while “in control”. The formulas for EWMA charts are listed below.

Each sample interval has only one value, for a subgroup sample size of one. So all you need to consider is the weighted average stand-in value, $$Z_i$$, value for for that sample interval.

Calculate the $$\mu_0$$ value as the mean of the actual data values. Let ($$X_1, X_2, …, X_N$$) be the measurement values of the N sample intervals. Or you can use a $$\mu_0$$ value that you know from previous runs.

$$\Large{\mu_0 = \bar{X}=\left(\frac{1}{N}\right)\sum_{i=1}^N X_i = \frac{(X_1 + X_2 + \cdots + X_N)}{N}}$$

The standard deviation value ($$\sigma$$ for the process is calculated using the sample standard deviation formula, seen below. Or you can use a $$\sigma$$ value that you know from previous runs.

$$\Large {\sigma = \sqrt{\frac{\sum_{i=1}^N X_i – \bar x}{N-1} }}$$

Assume that the test data in the chart above is such a run. You will find the raw sample data (1 sample per subinterval, 30 sample intervals (N)) in the table section of the chart below in the Sample row. The EWMA row shows the calculated EWMA values($$Z_i$$) value for each sample interval.

### Control Limits for the EWMA chart

$$\Large{UCL=\mu_0 + L * \sigma \sqrt{\frac{\lambda}{(2-\lambda)}\left[{1-(1-\lambda)^{2i}}\right]}}$$

$$\Large{Target =\mu_0}$$

$$\Large{LCL=\mu_0 – L * \sigma \sqrt{\frac{\lambda}{(2-\lambda)}\left[{1-(1-\lambda)^{2i}}\right]}}$$

The value $$\mu_0$$ is the process mean. The value $$\sigma$$ is the process standard deviation. The constant $$\lambda$$ is the user specified smoothing value (usually in range 0.05 to 0.30). The width of the control limits is controlled by the constant L, where the typical value for L is in the range of 2.7 to 3.0 (corresponding to the usual three-sigma control limits). The software does not calculate optimal $$\lambda$$ and L values; that is up to you, the programmer to supply, based on your experience with EWMA charts. Note that the term $${1-(1-\lambda)^{2i}}$$ approaches unity as i increases. The implies that the control limits of an EWMA chart will reach approximate steady state values defined by:

$$\Large{UCL=\mu_0 + L * \sigma \sqrt{\frac{\lambda}{(2-\lambda)}}}$$

$$\Large{LCL=\mu_0 – L * \sigma \sqrt{\frac{\lambda}{(2-\lambda)}}}$$

It is best if you use the exact equations that take into account the sample period, so that an out of control process can be detected using the tighter control limits that are calculated for small i. If the EWMA chart is used with subgroup sample sizes greater than 1, the value of $$X_i$$ is replace by the mean of the corresponding sample subgroup, and the value of $$\sigma$$ is replaced by the value $$\frac{\sigma}{\sqrt{M}}$$ , where M is the sample subgroup size.

EWMA Chart – 2 (Interactive)

Setup Values: L=3.0, $$\lambda=0.1$$

The starting value, and the Target value, are calculated as the mean of the raw data: $$\mu_0=10.315$$

The $$\sigma$$ value used in the UCL and LCL calculations is calculated as the standard deviation of the raw data: $$\sigma=1.154$$

The initial chart represents a sample run where the process is considered to be in control. Therefore it is a suitable source of data to calculate the UCL, LCL and Target control limits. The control limit lines and values displayed in the chart are a result these calculations. What you don’t want to do is constantly recalculate control limits based on current data. Because once the process goes out of control, you will be incorporating these new, out of control values, into the control limit calculations, which will widen the control limits. Instead, as you move forward, you apply the previously calculated control limits to the new sampled data. When the process starts to go out of control, it should produce alarms when compared to the control limits calculated when the process was in control. You can simulate this using the interactive chart above.

When you select the Simulate Data button in the Individual-Range Chart-2 chart above, the dialog below appears:

What it shows for the Mean value and Sigma value are the values calculated based on the current data. So if you simulate new sample intervals using these values, the result will be that the new values look like the old, and the process will continue to stay within limits. Even using these values, you will, however, get a random control limit violation every once in a while. This is known as a false positive (alarm) and it is due to the probabilistic nature of SPC control charts. See the section on Average Run Length (ARL) for more details. But if you modify the Mean and/or the Sigma value slightly, you increase the odds, above that of the ARL value, that process exceeds the pre-established control limits and generates an alarm. So change the Mean value to 10.8, and the Sigma Value to 1.5. Now you are simulating the process has changed enough to alter the both the mean and variability of the process variable under measurement. Press the Press to Add Data button a couple of time to generated the simulated values, then exit the dialog by pressing OK. The new data values are appended to the existing data values, and you should be able to see the change starting at the 20th sample interval. Use the scrollbar at the bottom of the chart to scroll to the start of the simulated data. The picture below displays the simulation. Your picture may not look exactly the same, because the simulated data values are randomized, and your randomized simulation data will not match the values in the picture. But the general idea will be the same. You find a more generalized, and detailed discussion of how to work with the Interactive charts here:

If you want to try and plot your own data in the EWMA chart, you should be able to do so using the Import Data option of the Interactive chart. Organize your data in a spreadsheet, where the rows represent sample intervals. Since this an EWMA chart, there should only be one column, representing one sample value per sample interval. Make sure you only highlight the actual data values, not row or column headings, as in the example below.

Copy the rectangle of data values from the spreadsheet and Paste them into the Data input box. By default, data values copied from a spreadsheet should be column delimited with the TAB character, and row delimited with the LF (LineFeed) character. In the case of a single column, there will be no TAB character, just the LF character delineating each new row.

Select OK, and if the data parses properly you should see the resulting data in the chart. By default, data entered into the Data input box overwrites all of the existing data. That way you can create your own custom Individual-Range chart, using only your own data. You start by entering in a batch of data from an “in control” run of your process, and display the data in a new chart. Calculate new control limits based on this data, using the Recalculate Limits button. Should you want to enter in another batch of actual data from a recent run, and append it to the original data, go back to the Import Data menu option. This time select the Append checkbox instead of the default Overwrite data checkbox.