I have a distribution $X$ with an unknown mean and variance. I wish to calculate its variance, but all I am given is an infinite series of data points $(y_i, n_i)$ of the form:

$$y_i = \sum_{n_i} x$$

For each $x$ drawn independently from $X$ and $n_i$ a positive integer in some small interval, if that helps (e.g. $n_i$ can vary between 1 and 10, say).

In other words, I might be given a data point drawn from the distribution equal to drawing three samples from $X$ and summing them, the next data point might be drawn from the distribution equal to drawing eight samples from $X$ and summing them, and so on.

I already know how to estimate the mean of $X$ given any number of data points, which is just $\sum y_i / \sum n_i$ for all my data points so far (and this will become more and more accurate as I get more and more data points). But is there a formula to determine the variance of $X$ from the $(y_i, n_i)$ pairs in the same way? I've tried everything and I just can't work it out.

| cite | improve this question | | | | |
  • $\begingroup$ 1. Should $x_i$ in the first equation be $x_j$? (Maybe something like $x_{i,j}$ would be even more clear). Are all drawn values of $x$ independent? 2. If you have an infinite series, $\sum n_i$ is infinite, so how is $\sum y_i / \sum n_i$ defined? Are you actually looking for how to estimate the mean and variance from a finite sample? $\endgroup$ – Juho Kokkala Apr 23 '18 at 6:50
  • 1
    $\begingroup$ @JuhoKokkala Yes, all values of $x$ are independent. I wasn't sure how to express this in math notation; I just want to say that $y_i$ is a sum of $n_i$ values independently drawn from $X$ $\endgroup$ – hunter2 Apr 23 '18 at 6:52
  • 1
    $\begingroup$ @JuhoKokkala Yes, I'd like to be able to produce an estimate after any finite number of data points, that eventually converges to the true mean/variance of $X$ as the number of data points increases. $\endgroup$ – hunter2 Apr 23 '18 at 6:55
  • $\begingroup$ Could you edit the question to clarify these issues. You don't have to use "math notation" for the independence, English is fine $\endgroup$ – Juho Kokkala Apr 23 '18 at 6:55

Using the properties of variance, assuming all $x_j$ are independent, and if $Var(X) = \sigma^2$,

\begin{align*} Var(y_i) & = Var\left(\sum_{j=1}^{n_i} x_j\right)\\ & = \sum_{j=1}^{n_i} Var(x_j)\\ & = \sum_{j=1}^{n_i} \sigma^2\\ & = n_i\sigma^2\,. \end{align*}

Again, using properties of variance, this means that $$Var\left( \dfrac{y_i}{\sqrt{n_i}}\right) = \sigma^2 \,.$$

So, first, normalize all the $y_i$'s by the square root of $n_i$, that is let $$z_i = \dfrac{y_i}{\sqrt{n_i}} \,.$$

Then, each of the $z_1, z_2, ..., z_N$ have variance $\sigma^2$ and the sample mean is $$\bar{z} = \dfrac{1}{N} \sum \dfrac{y_i}{\sqrt{n_i}}\,. $$

So $Var(X)$ can be estimated with $$\hat{\sigma}^2 = \dfrac{1}{N-1} \sum_{i=1}^{N} (z_i - \bar{z})^2\,. $$

| cite | improve this answer | | | | |
  • 1
    $\begingroup$ Wow, thanks, I missing the normalization step, I was trying to divide by $n_i$ and getting confused - that fixed everything and it works beautifully! Thansk so much $\endgroup$ – hunter2 Apr 23 '18 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.