Pooled-mean compatibility under rounding (source code)

= Pooled-mean compatibility under rounding
{title2=$\overline y=\sum_g(n_g/N)\overline y_g$}

= Rounded subgroup-mean compatibility
{synonym}

For a <partition of a set> of complete sample observations into groups of known sizes $n_g$ and total $N$, its <sample mean> is the <weighted mean> of the group <sample means>. Indeed, dividing $\sum_g\sum_{i\in g}y_i=\sum_g n_g\overline y_g$ by $N$ proves the identity. If the printed group means $m_g$ each have absolute <rounding error> at most $\delta_g$, their compatible pooled mean lies in
$$
\left[\sum_g\frac{n_g}{N}(m_g-\delta_g),\ \sum_g\frac{n_g}{N}(m_g+\delta_g)\right].
$$
This follows because all the weights are nonnegative. Equivalently, the pooled absolute <rounding error> is at most $\sum_g(n_g/N)\delta_g$, by the <triangle inequality>. A printed overall mean must have a <rounding> interval intersecting this interval. Disjoint intervals prove incompatibility, rather than merely a difference of displayed decimals. This is a necessary consistency check for means of the same complete sample; it cannot silently equate a full-sample mean with a different complete-case mean or establish a unique repair to inconsistent output.