10
$\begingroup$

Sorry if this question is this community's equivalent of asking a chef how to boil water, but if you had a data set that consists of:

[A±a, B±b, C±c, ..., N±n], where each value has a corresponding zero-order measurement uncertainty (as in, if you have a ruler with 1 mm ticks, the uncertainty would be 0.5 mm), you could very easily find the mean by just summing each nominal value and dividing by the number of values. But how would you find the uncertainty in that mean?

More specifically, say you had the following data set, obtained by repeated trials of a system: [16±0.5, 21±0.5, 22±0.5]. The mean is obviously (16+21+22)/3 = 19.7. But how would you find the uncertainty of that mean?

$\endgroup$
9
  • 1
    $\begingroup$ Hi! Are you willing to assume a probability distribution over those values? $\endgroup$
    – utobi
    Jan 25, 2023 at 21:59
  • 3
    $\begingroup$ Are the values independent? Also, what exactly do the numbers after the $\pm$ represent? Standard deviations? Standard errors? $\endgroup$ Jan 25, 2023 at 22:01
  • $\begingroup$ @utobi, a uniform distribution would probably make the most sense. The values were obtained by reading what is for all intents and purposes a ruler, and the zero-order measurement uncertainty is just half of the minimum ticks on the ruler. $\endgroup$ Jan 25, 2023 at 22:04
  • 1
    $\begingroup$ So do you have distributions like $U(15.5, 16.5)$, $U(20.5, 21.5)$, etc? $\endgroup$
    – Dave
    Jan 25, 2023 at 22:08
  • 1
    $\begingroup$ @utobi, you lost me. I'm not sure what you mean. For reference, I am a Mechanical Engineering student with not much background in statistics. $\endgroup$ Jan 25, 2023 at 22:11

1 Answer 1

9
$\begingroup$

Assuming the observations are collected independently of each other, the easiest way I can think of is to propagate uncertainty by using simulation. The idea is to generate random vectors from the (hyper-)cube and take the average of their coordinates; do this a large number of times and collect all the values obtained (the histogram below).

Here is an R code to illustrate it.

# set up a function to handle the simulation process
gen_x <- function() {
x = c(runif(1, 16-0.5,16+0.5),
      runif(1, 21-0.5,21+0.5),
      runif(1, 22-0.5, 22+0.5))
return(mean(x))
}

N=1e+4

# evaluate the function N times
hh <- sapply(1:N, function(x) gen_x())
hist(hh)
abline(v = mean(c(16,21,22)))

enter image description here

The histogram shows the distribution of the average of 16,21,22 taking into account the uncertainty of $\pm 0.5$ and assuming independent uniform distributions centred at the given values. The vertical line shows the sample average $(16+21+22)/3$.

The above solution gives the entire distribution of the sample average. If you are only interested in the variance of the sample average, then that's just equal to $1/(12n)$. Indeed, If you denote the sample $X_1,\ldots,X_n$, setting $\bar X = n^{-1}\sum_i X_i$ the sample average and assuming $X_i$ are independent, we have

$$ \text{var}(\bar X) = n^{-2}(\text{var}(X_1)+\cdots +\text{var}(X_n)) = n^{-2}\frac{n}{12} = (12n)^{-1}. $$

Here I have used the fact that if $X \sim \text{Unif}(a,b)$, then $\text{var}(X) = (b-a)^2/12$.

So to sum up, if your $n$ samples are independent and the measures can be thought of as $\pm 0.5$ around the value measured, then, under the uniform assumption of the measure within each interval, the variance of the average is $(12n)^{-1}$.

$\endgroup$
2
  • 2
    $\begingroup$ Wouldn't the variance of the mean of $n$ uniform distributions each with a range of $1$ be $1/(12n)$? In this case, $1/36$ which agrees with your simulation. $\endgroup$ Jan 25, 2023 at 22:32
  • 2
    $\begingroup$ @COOLSerdash: yes you are correct. I'll update my answer adding the analytical approach based on your suggestion. $\endgroup$
    – utobi
    Jan 25, 2023 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.