In a previous question Different Ways to Calculate the Weighted Average?, I tried to derive the formula myself for the Variance of Pooled Means when there are two groups:
\begin{equation} \mu_{weighted} = \frac{\bar{x}n + \bar{y}m}{n+m} \end{equation}
$$Var(\mu_{weighted}) = \frac{n^2}{(n+m)^2}s_1^2 + \frac{m^2}{(n+m)^2}s_2^2 + \frac{n}{(n+m)^2} \cdot \frac{m}{(n+m)^2} (\bar{x} - \bar{y})^2$$
Where:
- the sample means are $\bar{x}$ and $\bar{y}$.
- the sample sizes are population $n$ and $m$
- the sample variances are $Var (\bar{x}) = S_1^2$ and $Var (\bar{y}) = S_2^2$.
- you are NOT given the individual observations: $x_1, x_2, \dots, x_n , y_1, y_2, \dots, y_m$
My Question: Now, I am trying to extend these formulas for "N" number of groups:
$$\mu_{\text{weighted}} = \frac{\sum_{i=1}^N \bar{x}_i N_i}{\sum_{i=1}^N N_i}$$
$$\text{var}(\mu_\text{weighted}) = \sum_{i=1}^n \frac{N_i^2 s_i^2}{\left(\sum_{j=1}^n N_j\right)^2} + \sum_{i=1}^n \sum_{j=i+1}^n \frac{N_i}{\left(\sum_{j=1}^n N_j\right)^2} \frac{N_j}{\left(\sum_{j=1}^n N_j\right)^2} (x̄_i - x̄_j)^2$$
Can someone please tell me if I have done this correctly?
Thanks!