# Is the average of subset averages better than the average of the whole?

My robot has a laser time-of-flight distance sensor. Holding the distance and target constant: When I take single set of readings, three standard deviations usually is 3% to 6% of the mean.

If I take multiple sets of readings, each set will show three standard deviations to be 3-6% of the mean, BUT, averaging the averages from each set will show much lower standard deviation, such that three standard deviations will be between 0.5 to 2% of the mean.

Am I getting a more accurate reading by the average of averages of subsets, than the average of a whole set?

(Or am I just seeing the benefit of an average over individual readings?)

Adjusted For Error Average Distance: 1099 mm

17:30:55
Adjusted For Error Average Distance: 1097 mm

17:30:59
Adjusted For Error Average Distance: 1099 mm

17:31:03
Adjusted For Error Average Distance: 1101 mm

17:31:07
Adjusted For Error Average Distance: 1104 mm

Average Average: 1113 mm
Minimum Average: 1110 mm
Maximum Average: 1118 mm
Std Dev Average: 3 mm
Three SD averages vs ave reading: 0.7 %
Three SD all vs ave all readings: 5.0 %

If the subsets are all the same size, the averages are necessarily the same. Suppose you divide your $$N$$ measurements $$a$$ into $$n$$ groups of $$m$$. Then $$\frac{1}{n}\sum_{i = 1}^n\left(\frac{1}{m}\sum_{j=1}^m a_{ij}\right) = \frac{1}{mn} \sum_{i = 1}^n\sum_{j=1}^m a_{ij} = \frac{1}{N}\sum_{i = 1}^n\sum_{j=1}^m a_{ij}$$ Since each each measurement appears exactly once in that sum, it is simply the average over all the measurements.

If the subsets are not all the same size, then measurements from smaller subsets will have higher weight in the final average and it will not always equal the average of all the measurements. This should probably be avoided unless you have a specific reason for doing so.

There is natural fluctuation in the measurements, and the standard deviation $$(\sigma)$$ measures the size of those fluctuations.

The averages fluctuate less, by $$\sigma/\sqrt n$$. That is the point of taking a mean. So you can divide those $$\sigma$$, which are about 16, by $$\sqrt{20}$$, to say how precise each mean is. The precision is 3 or 4.

In the final answer, you have 100 measurements, so your final average is accurate to $$16/\sqrt{100}\approx1.6$$. On the other hand, you have five measured averages, each accurate to 3mm, so the overall precision is $$3/\sqrt5\approx1.34$$. I think the difference between 1.6 and 1.34 is roundoff error.

Three standard deviations in each of the five estimates would be $$3×16/\sqrt{20}\approx11mm$$. Three standard deviations in the overall average would be$$3×1.6\approx5mm$$.

• So do I have this right then: At this distance/target/incident_angle, I am seeing single readings of roughly +/- 3𝜎 (48mm/1110mm or +/- 4%) and average readings of roughly +/-3𝜎/√𝑛 (4.8/1110 for n=100 +/-0.4% or about +/-1% for n=20)? I'm trying to program adaptation for expected errors. Error rates of 4-6% can start stacking up quickly, where 0.5-1% gives the appearance of doing what I ask of the little guy. Commented Jul 15, 2019 at 1:20
• Yes, thats correct. Commented Jul 15, 2019 at 2:31