# Weighted mean based on standard deviation

I have a set of estimates, each with a confidence interval that has its own standard deviation.

I want to find the mean of the estimates (red dots in figure), but weight them based on the confidence intervals (blue lines), so that outlying estimates with large confidence intervals and thus less reliability such as the one pointed to have less of an impact. What is the best way to go about this?

Each estimate is $$\phi_i$$ and each confidence interval has a standard deviation $$\sigma_i$$. I was debating something along the lines of this:

$$\frac{1}{N\sum_i \sigma_i}\sum_i \frac{\phi_i}{\sigma_i}$$

but I feel like this might be incorrect.

Thanks

Recall that weighted mean is

$$\bar x = \frac{\sum_i w_i x_i} {\sum_i w_i}$$

with $$w_i \ge 0$$, where arithmetic mean is just a special case with $$w_i = 1/n$$

$$\bar x = \frac{\sum_i 1/n \; x_i} {\sum_i 1/n} = \frac{\sum_i 1/n \; x_i} {1} = \sum_i 1/n \; x_i = 1/n \sum_i x_i$$

If you want to weight by inverse of standard deviations $$w_i = 1/\sigma_i$$

$$\sum_i \frac{\phi_i}{\sigma_i} \bigg/ \sum_i \frac{1}{\sigma_i}$$

If you want to correct additionally for the sample sizes, use standard error instead of standard deviation as a weight.

If you include $$N$$ in normalization, the result is on completely different scale (compare to using arithmetic mean) as compared to scaling by the weights alone.

> set.seed(42)
> k <- 10
> n <- 100 * k
> grp <- rep(1:k, length.out=n)
> x <- rnorm(n)
> phi <- as.vector(by(x, grp, mean))
> sigma <- as.vector(by(x, grp, sd))
> mean(x)
[1] -0.02582443
> mean(phi)
[1] -0.02582443
> sum(phi/sigma) / sum(1/sigma)
[1] -0.02440608
> sum(phi/sigma) / (n*sum(1/sigma))
[1] -2.440608e-05

• So I don't need the sample size N? Thank you though for the concise explanation, my stats are weak but this was very clear.
– Jack
Commented Oct 5, 2021 at 8:23
• To clarify, I meant N as in number of estimates. Looking at the equations (sorry I don't know how to format in comments), w = 1/sigma. So should the final equation not be multiplied by the sum of sigma, instead of 1 over the sum of sigma?
– Jack
Commented Oct 5, 2021 at 8:44
• Perhaps I am misunderstanding. Would the first equation you showed not simplify down from $\frac{\sum_i w_i x_i}{\sum_i w_i}$ to $\sum_i x_i$
– Jack
Commented Oct 5, 2021 at 8:58
• @Jack no because you multiply by $(1 / \sum_i w_i) (\sum_i w_i x_i)$. I edited the answer for clarity.
– Tim
Commented Oct 5, 2021 at 9:18
• Okay I think I misworded my question, your edited answer is now what I meant, and that is working perfectly. Thank you!
– Jack
Commented Oct 5, 2021 at 9:23