I have a sample of 100 items, each associated to a random variable for which I can compute expected value and variance: $X_1, X_2, ..., X_{100}$. From these, we can define the mean $\overline{X}=\frac{1}{100}\sum{X_i}$. I'd like to test the hypothesis $H_0:\mu=0$, (where $\mu$ is the true population mean from which the 100 items were sampled) but for that I need the variance of the sample of $X_i$'s.

So the question is: how do I compute the variance of the sample, given the individual expectations and variances of the random variables?

Thanks a lot!

EDIT: More info about the question

I have a set of 100 items, and there is a function that assigns a score to each of them. The problem is that computing that function is actually very expensive, so instead I have a process with which I can estimate the score: the more effort (e.g. money) I put into the process, the better the estimate (less variance). So initially the variance of each estimate is maximum, it decreases as I put more effort into the process, and eventually variance is 0 and expectation equals the actual score if I run the process completely (i.e. the original function).

Those 100 items represent just a random sample of a wider population of items, so I'd like to test the hypothesis of the population score being different from (or larger than) zero.

  • $\begingroup$ Are you asking for the sample variance as observed or some measure of the expected sample variance or something else? Are the $X_i$ independent? $\endgroup$
    – Henry
    Commented May 21, 2012 at 18:14
  • $\begingroup$ I ultimately want to test the hypothesis, so I understand I want the sample variance. Yes, they are independent. $\endgroup$ Commented May 21, 2012 at 18:23
  • 1
    $\begingroup$ Caerolus, could you please clarify whether (a) these random variables have a common distribution; (b) how you know their expected values and variances, and (c) why you would want to test this hypothesis when you already know the expectations? $\endgroup$
    – whuber
    Commented May 21, 2012 at 18:27
  • $\begingroup$ Edited the question with more info. Hope it is clear now. $\endgroup$ Commented May 21, 2012 at 18:35
  • $\begingroup$ Interpreting $\bar{X}$ as the sample mean obtained by calculation from the observed data $X_1, X_2, \dots, X_{100}$, what does it mean to test the hypothesis that $\bar{X} = 0$? $\bar{X}$ is just a number, check if happens to be $0$, and you are done. No need to do any testing. On the other hand, if $\bar{X}$ is a random variable, the hypothesis $H_0: \bar{X} = 0$ is meaningless. $\endgroup$ Commented May 21, 2012 at 18:36

2 Answers 2


This is a problem very often encountered in biology where they do a couple of independent experiments (100 in your case) sampled IID, each with their unknown own mean. The only thing they can do is estimate those means by again IID sampling. Typically, the variable $X_i$ is estimated by a sample of size $n_i$, so the variance will be $\sigma_i^2 = \sigma^2/n_i$, where $\sigma^2$ is the sampling variance, not the variance of $X$. Because each individual experiment can be written in the form $X_i + \varepsilon_{ij}$, the variance of that variable is $V + \sigma^2/n_i$, where $V$ is the variance of $X$.

You can compute the grand mean as $\bar{X} = \frac{1}{n}\sum_{i=1}^{100}n_i\bar{X_i}$, (where $n = \sum_{i=1}^{100}n_i$) which is a sum of the independent variables $\frac{n_i}{n}\bar{X_i}$. Their variance is $\frac{n_i^2}{n^2}V+\frac{n_i}{n^2}\sigma^2$, so by summing you get $\sum_{i=1}^{100}\frac{n_i^2}{n^2}V+\sigma^2/n$.

  • $\begingroup$ Thanks a lot, I think this is what I'm looking for. Do you have any reference for this? I'll read it carefully and comment $\endgroup$ Commented May 21, 2012 at 20:10
  • $\begingroup$ Happy to help! No reference needed because this is simple algebra. $\endgroup$
    – gui11aume
    Commented May 21, 2012 at 22:02
  • $\begingroup$ I think I get it. $V$ is the variance of $X$, but how do I compute $\sigma^2$? The problem is I don't know it. $\endgroup$ Commented May 22, 2012 at 0:47
  • $\begingroup$ You can estimate $\sigma^2$ like in ANOVA (weighted mean of the individual estimated variances), which gives you $\hat{\sigma^2}$. You can also compute an estimated variance of your 100 weighted means, say $S_{100}^2$ which is an estimator of the last formula I gave. Now all quantities are known (up to estimation) and you can deduce V. So in the end you get $\hat{V} = (n^2S_{100}^2 - n\hat{\sigma^2}) / \sum_{i=1}^{100}n_i^2$. $\endgroup$
    – gui11aume
    Commented May 22, 2012 at 8:51
  • $\begingroup$ Weighted mean of the individual estimated variances? I'm lost here, could you please provide an example? Say we have items 1, 2 and 3, with their corresponding $E_1$,$E_2$,$E_3$,$V_1$,$V_2$,$V_3$. I can compute the estimated mean, that is, $E_\overline{X}$ and $V_\overline{X}$. So how does it go? Thanks a lot! $\endgroup$ Commented May 22, 2012 at 11:42

Based on the revised question I take it that the $X_i$'s are independent with common mean $m$ but each having a different variance $σ_{i}^2$ then the sample mean has mean $m$ and variance $(∑ σ_{i}^2)/(100^2)$ I think that is what you wanted to know. But you want to test the hypothesis that $m=0$ and it is not clear what test statistic to use. Because the variances differ we don't even know for sure that the central limit theorem applies. So we can't even say that the sample mean is approximately normal.

  • $\begingroup$ So then the means are all equal and the variances are not? I am assuming that the estimates are unbiased estimates for the score. $\endgroup$ Commented May 21, 2012 at 18:42
  • $\begingroup$ I still don't know what you mean by the variance of the sample given that the 100 Xs can all have different variances. Your notation is wrong. It is the true mean that you are testing for 0 not the sample mean. $\endgroup$ Commented May 21, 2012 at 18:45
  • $\begingroup$ No, the $X_i$'s do not have a common mean $m$. Each item $i$ has an associated score, and $X_i$ is an estimate of that score. What you mention is the variance of the mean estimate $\overline{X}$; but I want the variance of the sample, so I can test the hypothesis of the population of scores. $\endgroup$ Commented May 21, 2012 at 18:59
  • $\begingroup$ This is still confusing. So you are saying that each Xi estimates a different score? Then what is the true mean? The average of the 100 true scores? If that is the case then my answer above is correct with m replaced by the average of the mis. There is still the problem of the distribution of the sample mean for the purpose of testing your hypothesis that the average score is 0. $\endgroup$ Commented May 21, 2012 at 19:00
  • $\begingroup$ Yes, they estimate different scores. The true mean is unknown. Maybe an example helps: say my population consists of person heights. I only have a sample of 100 people (items), but the problem is that I cannot compute the actual height, I can only compute an estimate ($X_i$). Still, given the 100 people and their height estimates, I want to test a hypothesis about the population heights. $\endgroup$ Commented May 21, 2012 at 19:04

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.