Related Links:
CUSUM and Shewhart for Normally Distributed Means Program Page
Shewhart and CUSUM
Means
Notation and Data
Example Shewhart
Example CUSUM
References
The Shewhart and CUSUM charts are commonly used quality control methods to detect deviations
from bench mark values. The basic assumption is that a steady state exists in a system, called the "in control"
state. The charts are used for continuous sampling to detect a change into the "out of control" state.
The Shewart chart is used to detect a sudden and major change, and is based on the detection of 3 consecutive measurements
2 or more Standard Deviations from the expected mean value, or 2 or more consecutive measurements 3 or more Standard
Deviations from the expected mean value
The CUSUM chart is used to detect small and persistent change, and is based on the cumulative sum of differences
between sampling measurements and the mean, (thus CUSUM). This assumes that, in the "in control" state the CUSUM would
hover around the expected mean level, as deviation around the mean would cancel each other out. In the "out of control"
state, there will be a bias away from the expected mean, and the CUSUM will drift away from the expected mean level.
The CUSUM programs on this site follow the approach outlined in the text book by Hawkins and Olwell (see references),
summarized as follows.
 The user defines the "in control". The central tendency and variance is defined, according to the nature of the data.
In the normally distributed measurements, these are the mean and the Standard Deviation.
 Using specific algorithms, the level of departure (h) from the central tendency to decide that the "out of control"
alarm should be triggered is calculated. This level is abbreviated as h
 h is calculated, depending on the amount of departure (k) the system is designed to detect, and the sensitivity
of the detection, in terms of the averaged run length (ARL). The ARL is the expected number of observations
between false alarms when the situation is "in control". Conceptually this represents the probability of Type I
Error (α). An average run length of 20 is equivalent to α=0.05, ARL of 100, α=0.01.
 Once the chart and the ARL are defined, sampling takes place at regular intervals. The departure from the expected
is corrected by k, then added to CUSUM. If the CUSUM regressed to 0 or beyond, as it often does when the situation
is "in control", the CUSUM recommences at 0.
 In most cases therefore, two CUSUMs can be plotted, one for excessive increase in value, and one for excessive
decrease in value (two tails). In most quality control situation however, only one of the tails is of interest.
 In the programs of this site, 3 levels of h are offered in default, for ARLs of 20 (α=0.05) for green alert,
50 (α=0.02) for yellow alert, and 100 (α=0.01) for red alert. The idea is that a green alert should trigger
a heightened expectancy, yellow alert triggers an investigation, and red alert triggers immediate response. However,
these are merely recommendations, and users should define their own levels of sensitivity.
CUSUM and Shewhart Charts for Normally Distributed Measurements
CUSUM for normally distributed means is a commonly used, because most measurements can be considered normally distributed,
or normally distributed after some form of transformation (see Numerical Transformation Programs Page)
On many occasions, when a large amount of data can be collected automatically, and in order to reduce variance, the
value for each data point can be the average of a number of observations. The adjusted variance, the Standard Error
used in CUSUM, is se=mean/sqrt(n). When single observations are used, n=1, and SE=SD.
In order to calculate the decision line h, the user needs to define the mean and Standard Deviation for "in control" state,
the departure from the mean the user wishes the CUSUM to detect, and the Average Run Length(ARL), which is the average number
of observations between false alarms while in the "in control" state.
The program provides default values to assist those not familiar with the program, including
 Default example data set, and its mean and Standard Deviation
 Default example of departure to be detected, and default sample size of averages for each data point
 Default 3 sets of ARL, at 20 (α=0.05), 50 (α=0.02) and 100 (α=0.01). These defaults are intuitively
easier to grasp for those more familiar with hypothesis testing. However it should be noted that these values are
generally considered too sensitive for industrial use, leading to frequent false alarms, unnecessary disruptions
to production, and expensive investigations. In industry, ARL of several thousands are common, particularly in
automated manufacturing processes, where quality sampling occurs in microsecond intervals.
Once the parameters are set, the program produces the characteristics of the CUSUM accordingly, even before there is
any data. These includes
 The h value for each ARL for the "in control" state, as defined by the user.
 The arl for each h value over a range of hypothetical departures into the "out of control" state. These represents
the average number of observations required for an alarm to be triggered, if the departure occurs.
Once the user is satisfied with the CUSUM parameters, data input can commence. In industry, continuous graphical
output are generated, and alarms triggered whenever CUMUM overlaps a decision h value. In health care, data are
more likely to be collected manually and processed in batches, but the principle of monitoring remains the same.
CUSUM
Although the parameters and the data used during input are all in real units such
as dollars, Kgs, inches, and so on, the charting is carried out in a statistical unit
called z, where z = (value  mean) / standard error.
The reasons for using z is firstly convention, this is how all the text books and
published papers present the results, so it is easier to compare what we do with the standard.
The second reason is standardisation. Although the z concept takes a bit of
time to get used to, it is a much clearer representation of what is going on once
one is familiar with it. Essentially it measures the amount of deviation from
the expected in standard error terms, when z=1, deviation is 1 standard error from
the expected.
The terms standard deviation and standard error need to be clarified. Most people are
used to standard deviation. However, in quality control, one may not always
use measurements directly. One may take 5 or 6 measurements, and averaged them,
and use the average for calculation. When this happens, the standard deviation
of the averaged measurement is much narrower than the standard deviation of
individual measurements, so the standard deviation is adjusted to standard
error where se = sd / sqrt(n), n being the number of measurements (sample size)
used for the averaging.
Averaging a number of measurements before analysis used to be a great labour
saving strategy when everything was done by paper and pencil. Nowadays, most
quality control procedures are computerised so there is no advantage in averaging. The sample
size is therefore commonly the single measurement (n=1), and the standard error is therefore
the same as the standard deviation.
All the results and the charts for both Shewhart and CUSUM are therefore in
this standard error (z) units. If users wish to present the results in the original
measurement units (grams, inches, and so on), all they need is to convert
the units back so that value = z x se + mean, and also rescaled the y axis of the plots
in a similar manner.
Shewhart Chart
As with CUSUM, the Shewhart chart for means first converts the measurements into standard error
units (z = (valuemean)/se), where standard error is calculated from the standard deviation (sd) and the number
of measurements used (n) to create the average for analysis (se = sd / sqrt(n)).
When the process is in control, z hovers around 0. From the table in Probability of z Explained and Table Page,
the probability of z being 2
or more Standard Error from the mean is 0.02275 (2.3%) and 3 or more se from the mean is 0.00135,
or 0.1%. It is therefore very unlikely to have 3 consecutive measurements 2 or
more Standard Errors from the mean, or 2 consecutive measurements 3 or more Standard Errors from the mean.
When this happens, the out of control alarm is triggered.
We control a machine that produces packets of sugar for the supermarkets.
The packet should contain 100g of sugar, with a standard deviation of 10g. This
is the bench mark.
We need to shut down and service the machine if part of it malfunctions, and the sugar packed
will have to be discarded. We therefore weighed the packets of sugar as they come
out of the machine, and use the Shewhart chart to detect such catastrophic failures.
Of all the parameters set out in the program, only the in control mean (bench mark), the
standard deviation, and the sample size is used. We set the in control mean
bench mark) to 100, and the standard deviation to 10. As we will be charting
individual values, the sample size=1, so the standard error is calculated as
se = sd/sqrt(n) = 10/sqrt(1) = 10.
We chart the values in standard deviate terms z_{i} = (v_{i}mean)/se
= (v_{i}100)/10.
We will draw our alert lines at 2 and 3 se from 0.
The Shewhart chart is shown to the right. It can be seen that, as the mean shifts from
the in control value of 100 to 102, the measurements shifts upwards, but as this
is small, the Shewhart chart cannot detect it. There is only one occasion that
a measurement exceeds 3 se, and 2 occasions (but not consecutive) that exceeded 2 se.
This example shows that Shewhart charts may be sensitive to major or catastrophic failures,
it is not sensitive to small but persistent departure from the bench mark.
We control a machine that produces packets of sugar
for the supermarkets. The packet should contain 100g of sugar, with a
standard deviation of 10g.
However, we do know that the nozzles clog up with time and the gears may wear out,
and when this happens the amount of sugar packed will gradually deviate from 100g.
We decided that when the mean shifts by more than 2g (a fifth of a standard deviation),
we will need to service the machine. We set up CUSUM to detect this.
 We set the mean and standard deviation as 100 and 10
 We set 2 as the departure from control. This means if the mean measurement
changed to >=102 or <=98 then we want to know.
 As the packets are weighed as they come off the machine, we will calculate
CUSUM with every packet, so the sample size is 1,
and the se = sd=10. All values are therefore converted to z where
z_{i}=(v_{i}100)/10.
 We set the 3 alert lines. We set the yellow alert to 20 (one false positive every 20 measurements.
We set the orange alert to 50, and red alert to 100.
Alert  arl  h± 
Yellow  20  2.7334 
Orange  50  4.5725 
Red  100  6.3463 
The 3 alert lines are defined as shown to the left. This means that the yellow
alert is triggered if CUSUM is outside of ±2.73se from the mean, the
orange alert if CUSUM is outside of ±4.57se from the mean, and
the red alert if CUSUM is outside of ± 6.35se from the mean.
The next able shows the behaviour of the system if an out of control shift in
the mean actually occurs, assuming that the standard deviation remains the same.
The table above shows the average run length before the alert line will be
crossed. The table provides theoretical shifts in the mean in either direction
for 10 increments up to the level of shift defined by the user.
mean  z  arlY+  arlY  arlY±  arlO+  arlO  arlO±  arlR+  arlR  arlR± 
98  0.2  28  16  10  84  33  24  205  56  44 
98.2  0.18  27  16  10  79  34  24  190  60  46 
98.4  0.16  26  17  10  75  36  25  176  63  47 
98.6  0.14  25  17  10  71  37  25  163  67  48 
98.8  0.12  24  17  10  68  39  25  151  71  48 
99  0.1  24  18  10  64  41  25  141  75  49 
99.2  0.08  23  18  10  61  42  25  131  79  50 
99.4  0.06  22  19  10  58  44  25  121  84  50 
99.6  0.04  22  19  10  55  46  25  113  89  50 
99.8  0.02  21  20  10  53  48  25  107  95  50 
100  0  20  20  10  50  50  25  100  100  50 
100.2  0.02  20  21  10  48  53  25  95  107  50 
100.4  0.04  19  22  10  46  55  25  89  113  50 
100.6  0.06  19  22  10  44  58  25  84  121  50 
100.8  0.08  18  23  10  42  61  25  79  131  50 
101  0.1  18  24  10  41  64  25  75  141  49 
101.2  0.12  17  24  10  39  68  25  71  151  48 
101.4  0.14  17  25  10  37  71  25  67  163  48 
101.6  0.16  17  26  10  36  75  25  63  176  47 
101.8  0.18  16  27  10  34  79  24  60  190  46 
102  0.2  16  28  10  33  84  24  56  205  44 
For example, if the system goes out of control, and the mean shifts from 100 to 101 (a tenth of a standard error),
then on average CUSUM will cross the upper yellow alert line at 2.73se in 18 measurement, crosses lower yellow line at 2.73se
in 24 measurement, or crosses either (±2.73se) in 10 measurements. CUSUM will also cross either of the orange alert
line on average in 25 measurement and the red in 49 measurements.
This table therefore allows the users to gauge the sensitivity and false positive
tendency of the arl value that is defined.
We use the same template parameters as in the Shewhart example. The first
30 values have a mean of 100 and standard deviation of 10, the last 50 values
have a mean of 102 and standard deviation of 10. The plot of the data can be
seen in the Shewhart chart example.
The CUSUM plot can be seen below and to the left. It can be seen from the plot that two
sets of CUSUM lines are drawn, one for departure above the mean, the other for
departure below. In most situations, the user is only interested in one of
them and the other can be deleted. In this example however we are interested
in both, as excessive amount in the package will reduce profits, and insufficient amount
may cause the batch to be rejected by the supermarket.
The 3 alert line are shown. It can be seen that the yellow alert line is a
bit too sensitive, as on average this is reached every 20 measurements even
when the processes are in control. The orange and red alert lines appear to
be better decision criteria, but care should be taken not to rushed into
action at the orange alert line, as a false positive still occurs on average
every 50 measurements.
In manufacturing, when measurements may be taken several times a second, the arl is
usually set to tens of thousands, as frequent false positives disrupts production
and cannot be tolerated.
In health care and clinical practice however, measurements may only be taken
daily, or sometimes monthly. Should departure from bench marks occurs, regulators
cannot wait for months before an investigation is initiated, and such an investigation
does not disrupt services anyway. In these circumstances, a much shorter arl
can be used, and the more frequent false positive accepted.
This CUSUM chart can be compared to the Shewhart, and its sensitivity to
small and persistent change demonstrated.
Normal distribution : Steel R.G.D., Torrie J.H., Dickey D.A. Principles and
Procedures of Statistics. A Biomedical Approach. 3rd. Ed. (1997)ISBN 0070610282 p 6776
CUSUM : Hawkins DM, Olwell DH (1997) Cumulative sum charts and charting for
quality improvement. SpringerVerlag New York. ISBN 0387983651 p 4774
Computer program to calculate CUSUM decision limits can be downloaded from
http://www.stat.umn.edu/cusum/software.htm
Hawkins DM (1992) A fast accurate approximation for average run lengths
of CUSUM control charts. Journal of quality technology 24:1 (Jan) p 3743 (this is the algorithm
used by StatTools in the CUSUM and Shewhart for Normally Distributed Means Program Page.
