liveBook · Manning

Relative standard deviation

As explained in Modern C, Third Edition

Relative standard deviation is the standard deviation divided by the mean, expressing dispersion relative to the measured magnitude.

A variable timing sample

Suppose repeated run times have a mean of 0.6 seconds and a standard deviation of 0.31 seconds. Their relative standard deviation is 0.31 / 0.6 ≈ 0.52, or 52%. The spread is substantial relative to the time being measured. section 16.4

Relative standard deviation is σ(S) / μ(S): standard deviation divided by the sample mean. For run times, it should be in a low percentage range. A high value may indicate variation in the computation, disturbance of the measurement, or both; it does not identify which cause is responsible. section 16.4

Listing 16.5 Printing time stats with stats_mean and stats_rsdev_unbiased
  for (unsigned i = 0; i < loops; i++) {
    double mean = stats_mean(&statistic[i]);
    double rsdev  = stats_rsdev_unbiased(&statistic[i]);
    printf("loop %u: E(t) (sec):\t%5.2e ± %4.02f%%,\tloop body %5.2e\n",
           i, mean, 100.0*rsdev, mean/iterations);
  }
  

The C listing prints a mean run time alongside `100.0*rsdev`, converting the relative standard deviation to a percentage. section 16.4

How Modern C, Third Edition covers it

How deep it goes
Defines the ratio, works through a numerical sample, and gives a low-percentage rule without a precise cutoff.
Examples
Uses a 0.6-second mean with 0.31-second standard deviation, plus C output formatted as a percentage.
What it assumes
Assumes familiarity with basic statistical quantities and uses C timing code to show the metric in practice.
What you can do after
Evaluate/understand whether a run-time sample has acceptably low relative variation, without treating the metric as a diagnosis of its cause.
How it connects
Connects standard deviation and mean to measurement reliability and possible disturbances in computation or measurement.

Also explained in

Compare how 2 books explain relative standard deviation →

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.