Home / Statistical Tools / Control Charts / G Chart / Math Details
Math Details¶
This page gives the exact formulas Quantum XL uses to build a G chart. Almost nothing on this chart works the way a Shewhart chart works: there is no standard deviation, no constant, and no distance from a center line. Every line is a quantile of a fitted geometric distribution, and the sigma multiplier only decides which quantiles.
Notation¶
| Term | Description |
|---|---|
| \(i\) | event index, in plotted order |
| \(x_i\) | the count of opportunities between event \(i-1\) and event \(i\), the value plotted |
| \(N\) | number of counts entering the estimate |
| \(\bar{x}\) | mean of those counts |
| \(p\), \(\hat{p}\) | probability that any single opportunity is an event, and its estimate |
| \(k\) | sigma multiplier, from Number of StDevs:, default \(3\) |
| \(d\) | \(k/3\), the zone step in normal-probability space |
| \(\Phi\) | cumulative distribution function of the standard normal distribution |
| \(q_j\) | the \(j\)th of seven probabilities the lines are drawn at |
| \(F\), \(F^{-1}\) | cumulative distribution function of the fitted geometric distribution, and its inverse |
| \(\text{CL}\), \(\text{UCL}\), \(\text{LCL}\) | center line and control limits |
The plotted statistic¶
A count of \(0\) is legitimate and means two events with nothing in between. When the input column is dates rather than counts, each count is the whole number of days between consecutive dates:
so a gap of 3.9 days contributes \(3\). The first date establishes the starting point and produces no plotted value, which is why \(N\) dates give \(N - 1\) counts. Dates must be non-decreasing; one out-of-order row stops the analysis.
The fitted distribution¶
The counts between events are modelled as geometric on the support \(0, 1, 2, \ldots\) (a count of \(0\) means two events in a row with no non-event unit in between):
\(p\) is the probability that any single unit is an event. It is estimated from the values included in the limit calculation:
The mean of this distribution is \((1 - p)/p\), so \(1/(\bar{x} + 1)\) is the method-of-moments estimate of \(p\). The leading factor \((N - 1)/N\) is a finite-sample correction: it lowers \(\hat{p}\) slightly, which lengthens the modelled gap between events and widens the limits. The correction fades as \(N\) grows.
Full details: Inverse CDF Control Limits.
Two things about \(\hat{p}\) are worth stating plainly, because both are easy to get wrong by assumption. It is not \(1/(\bar{x} + 1)\): the \((N-1)/N\) factor makes it slightly smaller, which widens the limits, and the effect is largest on the short records this chart is usually built from. And \(\hat{p}\) is estimated from the counts included in the limit calculation, so a baseline setting or an excluded outlier changes it, while every count is still plotted.
A supplied Historical pHat replaces \(\hat{p}\) outright. The data then affects nothing on the chart except the plotted points themselves.
From the sigma multiplier to seven probabilities¶
The sigma multiplier \(k\) is first turned into seven probabilities on the standard normal distribution. One third of \(k\) sets the zone step:
Each probability corresponds to one line on the chart:
| Probability | Line | Value at \(k = 3\) |
|---|---|---|
| \(q_1 = \Phi(-k)\) | lower control limit | \(0.00135\) |
| \(q_2 = \Phi(-2d)\) | Zone A lower boundary | \(0.02275\) |
| \(q_3 = \Phi(-d)\) | Zone B lower boundary | \(0.15866\) |
| \(q_4 = \Phi(0)\) | center line | \(0.5\) |
| \(q_5 = \Phi(d)\) | Zone B upper boundary | \(0.84134\) |
| \(q_6 = \Phi(2d)\) | Zone A upper boundary | \(0.97725\) |
| \(q_7 = \Phi(k)\) | upper control limit | \(0.99865\) |
Every line is then the quantile of the chart's own event distribution at its probability:
The center line is \(F^{-1}(0.5)\), the median of the fitted distribution. For a right-skewed distribution the median is below the mean, so the center line sits below the average count or average time between events.
Full details: Inverse CDF Control Limits.
So the multiplier never multiplies anything on this chart. It selects tail probabilities, and the shape of the geometric distribution decides how far from the center line those probabilities land.
Inverting a discrete distribution¶
The geometric distribution is discrete, so \(F\) only takes its values at whole numbers and there is generally no count whose cumulative probability is exactly \(q_j\). The quantile is taken from the straight line joining the two nearest points of the CDF. First locate the bracketing integer:
then interpolate between \(F(x_0)\) and \(F(x_0 + 1)\) and floor the result at zero:
The lines are therefore not whole counts, which is intended: a limit of \(0.42\) is a real limit for a count, not a rounding artifact. Interpolating the discrete CDF is not the same as solving \(F(x) = q_j\) for a continuous \(x\). The geometric CDF is concave, so a chord lies below the curve and the interpolated quantile is the larger of the two at small probabilities. With \(p = 0.4\) the interpolated center line is \(0.4167\) against \(0.3569\) from the continuous solution; the two agree closely at the upper control limit.
Full details: Inverse CDF Control Limits.
The lines that result¶
Three properties of this band are consequences of the arithmetic above rather than choices, and all three matter when reading a finished chart:
- The center line is a median. It is the count that half the gaps should fall below, and it is smaller than \(\bar{x}\), because the geometric distribution is right-skewed.
- The band is asymmetric. The distance up to the upper limit is several times the distance down to the lower one.
- The lower limit is \(0\) at any realistic event rate. \(q_1 = 0.00135\) at the default multiplier, and unless \(p\) is very large the \(0.135\)th percentile of the count is below zero before the floor is applied. With the limit at \(0\) and counts unable to go below it, no point can be flagged for being too low, so Rule 1 on this chart only ever reports a gap that is unexpectedly long.
Sigma zones¶
On the G and T charts, limits and zones are not placed at a fixed distance from the center line at all. Thirds of \(k\) are taken in standard normal probability space,
seven probabilities are formed with the standard normal CDF \(\Phi\), and each is pushed through the chart's own inverse CDF \(F^{-1}\) (an interpolated geometric distribution for the G chart, a three-parameter Weibull for the T chart):
The distribution being inverted is asymmetric, so these lines are not equal distances above and below the center line, and the spacing between them is uneven. The zone rules are not offered on these charts.
The zone boundaries are the same seven quantiles, so each boundary is placed by its probability rather than by a distance:
| Zone | Region |
|---|---|
| Zone C | between \(F^{-1}(\Phi(-d))\) and \(F^{-1}(\Phi(d))\) |
| Zone B | between \(F^{-1}(\Phi(\pm d))\) and \(F^{-1}(\Phi(\pm 2d))\) |
| Zone A | between \(F^{-1}(\Phi(\pm 2d))\) and the control limit on that side |
Because \(F^{-1}\) is not a straight line, the upper part of a zone is wider than the lower part of the same zone. The zone boundaries are not one and two standard deviations from the center line, and they are not equal distances from it. What is symmetric here is the probability content of each zone, not its width.
Full details: Control Limits and Zones and Inverse CDF Control Limits.
The practical consequence: do not read the zone lines on a G chart as one and two standard deviations, and do not expect them to be evenly spaced. Their probability content is what matches a normal chart's zones, not their width.
Out-of-control tests¶
The G chart runs Rule 1 by default and offers rules 2, 3, 4 and 9, all switched off when the dialog opens. Rules 5 through 8 are not offered and are disabled in the engine.
Point \(i\) is flagged when the plotted value falls outside the limits drawn at that point:
Both comparisons are strict, so a point sitting exactly on a control limit is not flagged. The test uses the limits as drawn, which means it follows stepped limits, manual limits, and transformed data with no special handling. The rule has no threshold of its own: its width is the chart's sigma multiplier \(k\), chosen with the control limits.
The engine also supports an independent multiple \(k^{*}\) for this rule. When one is supplied, one sigma of the plotted statistic is recovered separately for each side from the drawn limits,
and the test is applied at \(k^{*}\) of those units instead:
Recovering each side on its own means an asymmetric band gives an asymmetric per-side sigma. The only chart that uses an independent multiple is Levey-Jennings, whose 1-2s warning is this same test at \(k^{*} = 2\). On every other chart Rule 1 tests the drawn limits.
Point \(i\) is flagged when the \(N\) points ending at \(i\) all lie strictly on one side of the center line:
A point exactly on the center line belongs to neither side and ends both runs. Default \(N = 9\).
Point \(i\) is flagged when every step in the \(N\) steps ending at \(i\) moves the same way:
\(N\) counts steps between points, not points, so the pattern spans \(N+1\) points. With the default \(N = 6\) the seventh point of a monotone run is the first one flagged. Both comparisons are strict: two equal consecutive values end both runs.
Write the direction of the step into point \(j\) as
Point \(i\) is flagged when the \(N\) steps \(s_{i-N+1}, \ldots, s_i\) are all non-zero and each one has the opposite sign to the step before it. A tie between two consecutive points gives \(s_j = 0\) and ends the alternation. The pattern spans \(N+1\) points, so with the default \(N = 14\) the fifteenth point of a zigzag is the first one flagged.
Rule 9, the Benneyan test, is unique to this chart. No other chart in Quantum XL offers it, and the T chart does not show the row at all.
Point \(i\) is flagged when the \(N\) points ending at \(i\) are all exactly zero:
The comparison is an exact equality against zero, which suits a plotted statistic that counts whole opportunities between events. Default \(N = 4\), and the rule is off unless it is turned on.
A run of zeros is a cluster of events with no gap between them, which the quantile limits alone cannot catch: zero is inside the band, since the lower limit is zero.
A blank row keeps its position on the chart: it is plotted as a gap, and the points after it do not shift left. Each rule handles that gap in its own way.
| Rule | Effect of a blank point |
|---|---|
| 1 | the point is skipped and is never flagged |
| 2 | both same-side counts reset, so the gap breaks the run |
| 3 | both counts reset when either the current or the previous point is blank |
| 4 | the alternation count resets when any of the three points forming the two steps is blank |
| 5 and 6 | every window containing the blank point is discarded, so the gap blocks all \(M\) windows that overlap it |
| 7, 8, and 9 | the run count resets, so the gap breaks the run |
| R-4s | the pair containing the blank point is skipped |
A gap therefore breaks a run rather than bridging it.
Two other situations remove a point's limits, and they are not the same as a gap:
- A subgroup with no usable observation has no plotted value either, so it is a gap and the table above applies.
- An incomplete set of manual limits is rejected for the whole panel, and the panel is replaced by an error message instead of a chart, so no rule is evaluated or reported for it.
Turning the control limit type off is different again, and is covered separately below.
Full details: Out-of-Control Rules.
Baseline and split limits¶
Neither changes the formulas above; both change which counts the estimate runs over.
Baseline Estimation restricts \(\hat{p}\) to the first \(N\) events and extends the resulting lines across the whole chart. The minimum is 3 events, or 4 when the column holds dates. Formulas: Baseline and Limit Estimation.
Split Control Limits divides the chart into phases and re-estimates \(\hat{p}\) inside each one, so every phase gets its own median and its own limits. Formulas: Splits and Phases.
What the chart refuses¶
| Input | Result |
|---|---|
| Fewer than 3 counts, or fewer than 4 dates | The analysis stops: not enough data |
| Any negative value | The analysis stops |
| Dates out of chronological order | The analysis stops, naming both rows and both dates |
| Historical pHat at or outside 0 and 1 | The analysis stops: invalid override |
| A missing value in the middle of the column | That position plots nothing, and no center line, limit or zone line is drawn through it either |
Shared Math Details used here¶
| Shared concept | Used here for | Reference |
|---|---|---|
| Inverse CDF control limits | the probability ladder, the geometric model, the interpolated inverse, and the zone shape | Inverse CDF Control Limits |
| Control limits and zones | the rare-event zone construction | Control Limits and Zones |
| Out-of-control rules | rules 1 to 4 | Out-of-Control Rules |
| Baseline and limit estimation | what Baseline Estimation restricts | Baseline and Limit Estimation |
| Splits and phases | per-phase re-estimation | Splits and Phases |
What this chart contributes of its own is the discrete inverse: the interpolation of a step function that lets a count-valued chart carry limits that are not whole counts.
See Also¶
References¶
- Benneyan, J. C. (2001). "Number-Between g-Type Statistical Quality Control Charts for Monitoring Adverse Events." Health Care Management Science, 4(4), 305-318.
- Montgomery, D. C. (2013). Introduction to Statistical Quality Control (7th ed.). Wiley.
- Wheeler, D. J. (2011). "Working with Rare Events." Quality Digest.