# Does rounding introduce variance into estimates?

It is often recommended to round parameter estimates to avoid suggesting more precision than the data really have, e.g. here. I understand rounding does not introduce bias, as long as an unbiased rounding scheme is used, like statistician's rounding.

Does rounding introduce variance to the parameter estimate, however? Seems like it's just adding a stochastic component, which would introduce variance. On the other hand, maybe it reduces variance or has no effect on it -- I don't have intuition on this.

I did a simulation to try to get some answers. I'm using R's round function, which uses statistician's rounding.

n = 10000
m = matrix(rnorm(n*n), nrow = n, ncol = n)
rmeans = rowMeans(m)
var(rmeans)
var(round(rmeans, 2))


Running this R code returns:

> var(rmeans)
[1] 0.0001023963
> var(round(rmeans, 2))
[1] 0.0001105398


which suggests to me that rounding does introduce at least a little bit of additional variance.

Questions:

1. Does my simulation make sense?
2. How much variance does rounding introduce?
3. If rounding does introduce variance, how do we know when it's worth that cost?

It depends. But not on much, and you can predict what is likely to occur.

In many situations, rounding adds $1/12$ to the variance.

Consider any random variable $X$. Write $[X]$ for its rounded version. Then $R=X - [X]$ is a random variable, too, taking values between $-1/2$ and $1/2$. Except when the range of $X$ is small or $X$ takes on special values, we might hope that $R$ is uncorrelated with $X$: sometimes it's small, sometimes it's large, but there's little overall correspondence between $X$ and $R$. In such cases

$$\operatorname{Var}(X-[X]) \approx \operatorname{Var}(X) + \operatorname{Var}(R).$$

Furthermore, in many practical cases $R$ is approximately uniformly distributed across its range. This will happen when, say, $X$ is a continuous unimodal distribution with a standard deviation large compared to $1$. Because the mean of this uniform distribution is zero, its variance is its second moment,

$$\operatorname{Var}(R) \approx E[R^2] \approx \int_{-1/2}^{1/2} x^2\mathrm{d}x=\left.\frac{x^3}{3}\right|_{-1/2}^{1/2}=\frac{1}{12}.$$

Simulations bear out this conclusion. Here, for instance, are scatterplots of the variances of rounded values versus original values in 40,000 experiments involving samples of size 30 from Normal distributions, all with a mean of zero. In a quarter of these experiments the standard deviation (SD) of the distribution was $1/4$; in another quarter it was $1/2$; in another quarter $1$; and in the last quarter, $2$.

They all line up around the line of equality (shown as the black diagonal lines) and tend, as predicted, to be concentrated slightly above that line. The behavior for an SD of $1/4$ is complicated: when the sample variance is low, it means the numbers are almost all zeros. Rounding can reduce their variance to zero, or nearly so. (Notice the limited possibilities for the rounded variance in this case.) Here, $R$ is negatively correlated with $X$. But as the SD increases, the possibility of this negative correlation gradually vanishes.

Summary statistics show that the average differences between the rounded variances and variances are $-0.017$, $0.076$, $0.084$, and $0.085$ as the SD increases from $1/4$ to $2$. Already, by the time it is $1/2$, the mean difference of $0.076$ is very close to our approximate value of $1/12 = 0.083\ldots$.

We have learned that so long as $X$ doesn't concentrate its values especially on one side or the other of integers, the variance of $[X]$ should be approximately $1/12$ larger than the variance of $X$. This is because rounding indeed acts like adding uncorrelated (but not independent!) uniform "noise" to $X$. From these conclusions it is easy to answer the three questions.

The following is the R code to produce the simulations and plots. It is interesting to vary the sample size, the underlying distribution, and its mean.

library(ggplot2)
library(data.table)

n.sample <- 30
n <- 1e4

for (sigma in c(0.25, 0.5, 1, 2)) {
x <- matrix(rnorm(n * n.sample, mean=0, sd=sigma), ncol = n)
Y <- data.table(Variance=apply(x, 2, var),
Variance.rounded=apply(round(x), 2, var),
SD=sigma)
if (exists("X")) X <- rbind(X, Y) else X <- Y
}
X[, SD := ordered(SD, labels=c("1/4", "1/2", "1", "2"))]

ggplot(X, aes(Variance, Variance.rounded)) +
geom_point(size=0.8, shape=19, alpha=1/32) +
geom_abline(slope=1, intercept=0) +
geom_smooth(aes(color=SD)) +
facet_wrap(~ SD, scales="free") +
theme(aspect.ratio=1)

summary(lm(Variance.rounded-Variance ~ SD - 1, X))


Well, if you use a minimum-variance estimation method, and then adjusts this by rounding (rounding the data or rounding the estimate), then that adjusted estimation method cannot now be minumum variance! If that matters practically is another question.

If measurement only gives, say, two meaningful decimals, then data is in principle discrete and treating it as continuous is an approximation. So methods which are optimal (maybe minimum variance) in that approximate continuous model might not be optimal at the discrete truth.