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
 A: 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

