# Sample variance from second moment

if I have a sample composed by values lesser than 1 and i want to compute the sample variance with $\frac{n}{n-1}(\langle x_i^2 \rangle - \langle x_i \rangle^2)$ how can i do? Because the mean of the square is lesser than the square of the mean so the result is negative.. All is good if I use $\frac{1}{n-1}\sum((x_i - x_{mean})^2)$...

• You don't, because your formula is wrong. Double-check the parentheses. – whuber May 15 '15 at 18:27
• Is it the first equation wrong? (I have delete the sum in front of it) – Andrea Oliveri May 15 '15 at 18:58
• Now the formula makes no sense because the summation is gone but the bound subscript "$i$" remains. The angle brackets (presumably denoting expectations?) do not apply to a sample in any event. See stats.stackexchange.com/questions/146735, for instance. – whuber May 15 '15 at 19:37
• Ok so if i remove the subscript "i" and read angle brackets as expectation does the first equation equal to the second? (it's simply the expansion of the square of the second equation). But if are they equal why the first returns a negative number (for data lesser than 1)? – Andrea Oliveri May 16 '15 at 12:19
• The use of angle brackets as "expectation" is inconsistent with the intended meaning of a sample moment. If you're getting a negative value, then you are not computing according to a correct formula. – whuber May 16 '15 at 19:38