liveBook · Manning

C-chart

As explained in Statistics Every Programmer Needs

A c-chart is an attribute control chart for monitoring the count of defects per inspection unit when the inspection opportunity is constant.

A c-chart monitors the number of defects per inspection unit when each unit may contain multiple defects and the inspection opportunity remains constant. It supports quality-control decisions by distinguishing expected process variation from signals requiring investigation. section 14.2.3 section 14.1.9

Build and interpret a c-chart as follows:

  • Count every defect in each inspected unit, rather than counting only units that contain at least one defect. section 14.1.8
  • Estimate the center line with c̄, the mean number of defects per unit; model rare defects over a fixed interval with a Poisson distribution. section 14.2.3
  • Set UCL = c̄ + 3√c̄ and LCL = max(0, c̄ − 3√c̄), because defect counts cannot be negative. section 14.2.3
  • Investigate points outside the limits or unusual patterns; points within the limits indicate consistency but do not eliminate the need for broader chart analysis. section 14.2.3 section 14.4

Twenty-unit defect inspection

Generate 20 defect counts from a Poisson distribution with λ = 4, calculate c̄ and three-sigma limits, and plot the counts with center and control-limit lines. The demonstrated points remain within the limits, indicating a stable process. section 14.2.3

>>> np.random.seed(0)    #1
>>> units = 20     #2
>>> defects = np.random.poisson(lam = 4, 
>>>                             size = units)    #3
>>> c_bar = np.mean(defects)     #4
>>> UCL = c_bar + 3 * np.sqrt(c_bar)     #5
>>> LCL = max(0, c_bar - 3 * np.sqrt(c_bar))   #6
>>> plt.figure()    #7
>>> plt.plot(range(1, units + 1), defects,
>>>          marker = 'o', linestyle = '-', color = 'b',
>>>          label = 'Number of Defects')     #8
>>> plt.axhline(c_bar,
>>>             color = 'r', linestyle = '--',
>>>             label = 'Center Line')    #9
>>> plt.axhline(UCL,
>>>             color = 'g', linestyle = '--',
>>>             label = 'UCL')     #10
>>> plt.axhline(LCL,
>>>             color = 'g', linestyle = '--',
>>>             label = 'LCL')    #11
>>> plt.title('c-Chart')
>>> plt.xlabel('Unit Number')
>>> plt.ylabel('Number of Defects')
>>> plt.xticks(range(1, units + 1))
>>> plt.legend(loc = 'upper right',
>>>            bbox_to_anchor = (1, .95))
>>> plt.grid(True)
>>> plt.show()     #12

Use the listing to reproduce the calculation and visualization in Python with NumPy and Matplotlib. section 14.2.3

How Statistics Every Programmer Needs covers it

How deep it goes
Defines defect counting, Poisson simulation, center-line calculation, three-sigma limits, plotting, and stability interpretation.
Examples
Uses scratches, dents, and misalignments as defects and plots simulated counts for 20 inspected units.
What it assumes
Assumes defect counting and basic control-chart measures while defining the distinction between defects and defective items.
What you can do after
Apply it via Python to calculate limits, plot defect counts, and evaluate whether a process appears stable.
How it connects
Connects defect counts with attribute control charts, p-charts, np-charts, u-charts, g-charts, and Poisson distributions.

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.