The Engineering Desk
From the makers of RS-1

DesignSoftware Engineering

Validating statistical software

How to show that the numbers your quality decisions rest on are calculated correctly.

If a quality decision depends on a number a program calculated, someone has to show that the program calculates it correctly. Standards such as ISO 9001 and IATF 16949 expect software used for product acceptance to be validated. Medical device regulations go further. Validation doesn't have to be elaborate, but it does have to be deliberate.

Test against known answers

The core of numerical validation is simple: run the software on inputs whose correct outputs are already known, and compare. Good sources of known answers include:

  • NIST Statistical Reference Datasets (StRD). Certified results for univariate statistics, ANOVA, linear and nonlinear regression, at lower, average and higher difficulty levels.
  • Worked examples in standards and handbooks. The AIAG SPC and MSA manuals and the NIST/SEMATECH e-Handbook of Statistical Methods include full data sets with results.
  • Hand calculations for small cases, checked by a second person.
  • Independent software, as long as you remember it may share the same mistake.

How close is close enough?

NIST suggests judging accuracy by the number of matching significant digits, the log relative error:

LRE=−log⁡10 ⁣(∣q−c∣∣c∣)\text{LRE} = -\log_{10}\!\left(\frac{\lvert q - c \rvert}{\lvert c \rvert}\right)

where qq is the computed value and cc the certified value. An LRE of 6 means about six digits agree. For most quality work, four or five correct digits in a capability index or control limit is more than adequate. The real goal is to catch outright errors, such as a wrong constant or a wrong formula.

Cover the edge cases

Most software bugs live at the edges, not the middle:

  • Subgroups of size 1 or 2, unequal subgroup sizes, and missing values
  • Data with many leading digits in common (precision loss)
  • One-sided specifications, and data entirely outside the limits
  • Zero variation, which should give a clear message, not an infinite Cpk
  • Very large data sets, non-normal data and transformations

Document it

A validation record should list the software name and version, the tests run, expected and actual results, acceptance criteria, who ran it and when. Repeat the relevant tests after updates. Because modern software updates often, automated test suites that run on every release make this practical.

More in Software Engineering