liveBook · Manning

Attribute control chart

As explained in Statistics Every Programmer Needs

An attribute control chart is a statistical process-control chart that monitors counted or classified quality characteristics rather than continuous measurements.

An attribute control chart monitors categorical quality characteristics by counting defective items, proportions, defects, or intervals between rare events. It helps determine whether a process is stable, identify trends, and prompt corrective action. section 14.2 section 14.1.7

Choose the chart according to the quality measure and sampling pattern:

  • Use a p-chart for the proportion of defective items, especially when sample sizes vary. section 14.2
  • Use an np-chart for the number of defective items when sample sizes remain constant. section 14.2 section 14.1.7
  • Use a c-chart for the total number of defects when one unit can contain multiple defects. section 14.1.7 section 14.1.8
  • Use a u-chart for defects normalized by the number of inspected units when sample sizes vary. section 14.1.8
  • Use a g-chart for the number of units or opportunities between rare defects or failures. section 14.2.4

Interpret the plotted measure against its center line and control limits. Points outside the limits, trends, or unusual patterns can indicate instability; multiple charts may be needed to assess different aspects of a complex process. section 14.2.4 section 14.4

Monitoring intervals between defects

A g-chart plots defect sequence against units between defects. Its center line is the average interval, while upper and lower control limits identify unusual spacing. A dataset whose points remain within the limits indicates stability; an upward trend in intervals suggests improvement. section 14.2.4

>>> data = {
>>>     'defect_sequence': np.arange(1, 21),
>>>     'units_between_defects': [50, 30, 45, 60, 55, 35, 40,
>>>                               70, 65, 80, 75, 50, 85, 90,
>>>                               95, 60, 55, 100, 105, 110]
>>> } #1
>>> df = pd.DataFrame(data)   
>>> g_bar = df['units_between_defects'].mean()     #2
>>> UCL = g_bar + 3 * np.sqrt( \
>>>     g_bar * (g_bar + 1))     #3
>>> LCL = max(g_bar - 3 * np.sqrt( \
>>>     g_bar * (g_bar + 1)), 0)    #4
>>> plt.figure()    #5
>>> plt.plot(df['defect_sequence'], df['units_between_defects'],
>>>          marker = 'o', linestyle = '-',
>>>          label = 'Units Between Defects')     #6
>>> plt.axhline(y = g_bar,
>>>             color = 'r', linestyle = '--',
>>>             label = 'g-bar (Mean)')     #7
>>> plt.axhline(y = UCL,
>>>             color = 'g', linestyle = '--',
>>>             label = 'UCL')     #8
>>> plt.axhline(y = LCL,
>>>             color = 'g', linestyle = '--',
>>>             label = 'LCL')    #9
>>> plt.fill_between(df['defect_sequence'], LCL, UCL,
>>>                  color = 'g', alpha = 0.1)    #10
>>> plt.title('g-Chart')
>>> plt.xlabel('Defect Sequence')
>>> plt.ylabel('Units Between Defects')
>>> plt.legend()
>>> plt.grid(True)
>>> plt.show()     #11

The listing constructs a g-chart from defect intervals, calculates the mean and three-sigma-style limits, and plots the observations with reference lines. section 14.2.4

How Statistics Every Programmer Needs covers it

How deep it goes
Defines five chart types and their selection criteria, then works through g-chart construction and interpretation.
Examples
Uses defective-item counts, defect counts, variable sample sizes, and intervals between synthetic defect events.
What it assumes
Assumes basic quality-control concepts and distinguishes categorical defect data from continuous measurements.
What you can do after
Apply a suitable attribute chart and interpret its center line, control limits, trends, and stability signals.
How it connects
Connects p-charts, np-charts, c-charts, u-charts, g-charts, control limits, and variable control charts.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.