How to calculate error of the mean of some data with different errors We have some data. All of them has errors and there is also quantity (weight) for each one of them. how can we calculate the mean and its error for them. For example we have this data.
$$\begin{array}{c|c|c|} 
 & \text{Data (D)} & \text{Quantity of Each data (N)} \\ \hline
\text{1} & 14.9 \pm 1.2 & 10 \\ \hline
\text{2} & 21.1 \pm 3.9 & 7 \\ \hline
\text{3} & 15.2 \pm 1.1  & 8 \\ \hline
\text{4} & 18.8 \pm 3.8 & 9 \\ \hline
\text{5} & 15.9 \pm 0.9 & 4 \\ \hline
\text{6} & 15.8 \pm 1.5 & 6 \\ \hline
\text{7} & 16.8 \pm 2.4 & 5 \\ \hline
\text{8} & 19.4 \pm 5.0 & 8 \\ \hline
\end{array}$$
Somewhere I found a formula like this (for data without quantity and with just errors) but I don't know what it gives and what can I do with this. $$\frac{\Sigma{\frac{d_i}{ s_i^2}}} {\Sigma\frac{1}{s_i^2}}$$
 A: Suppose you have random variables $d_i$ with means $\mu_i$ and variance $\sigma^2_i$. Let $w_i$ be non-random real weights. I'll assume $d_i$ are independent. 
Note: if you want to include the variances in the weights you can use $w_i\leftarrow w_i/\sigma_i$ or $w_i\leftarrow w_i/\sigma_i^2$  for example.
Consider the normalized weights: $$ \gamma_i = w_i\left[\sum_j w_j\right]^{-1} $$
Then, consider the random variables $x_i=\gamma_id_i$, and define:
$$ X = \sum_i x_i = \sum_i w_i d_i  $$
Then $ \mathbb{E}[X] = \sum_i \gamma_i\mu_i $, i.e. the weighted average is the expectation of $X$ (recall $\gamma_i$ are normalized). 
Consider that $\mathbb{V}[x_i] = \gamma_i^2\sigma^2_i$.
Define $ \sigma^2 = \sum_j \gamma_j^2 \sigma_j^2 $.
Notice that: $$ \mathbb{V}[X] = \mathbb{V}\left[ \sum_i w_i d_i \right] =\sum_i\mathbb{V}\left[  w_i d_i \right] =\sum_i w_i^2\, \mathbb{V}\left[ d_i \right] = \sum_i\gamma_i^2\sigma_i^2 = \sigma^2 $$
We want to estimate the standard error of the mean of $X$. Can we simply say: $$ \text{SEM} = \sigma \;\;? $$
Well, using the Lindeberg CLT (also here), $X$ should converge to normality with enough samples, at least.
So, you could use: $$ \text{SEM}=\sigma=\sqrt{ \sum_j\gamma_j^2\sigma^2_j } $$

However, I think there is some level of heuristics present!
This question has some great discussions.
See also this wiki article.
