I got a stream of numbers in one of my apps to represent an electrical signal. I've observed that the signal ranges from -100 to +100. Other than that, the signal is fairly random and crosses 0 in most cases. I'm trying to understand if I'm calculating the standard deviation of this stream of numbers correctly.

  • I collect 1000 data points
  • I add all the data points and divide by 1000 to calculate the mean < This is the step that I'm not sure of. Do I need to add absolute values to calculate the mean if there are both positive and negative numbers?
  • I calculate the sum of square of differences for each value (value - mean)^2
  • I take a square root of the (sum of square differences divided by 1000) to get standard deviation

The result I get is something like 46.6 I'm trying to understand if this number appears correct given the steps above, or if I need to adjust how I calculate standard deviation to account for having negative numbers mixed with positive.

Thank you!

  • 1
    $\begingroup$ Don't add absolute value signs. Intuitively, there's nothing special about the choice of $0$ in your unit system, that is, if you shift all the points by $k$, the mean should shift by $k$ also. This evidently won't happen if you add the absolute values. $\endgroup$
    – Meow
    Feb 22, 2013 at 15:22
  • 2
    $\begingroup$ Example: the mean of $-4$ and $2$ is evidently $-1$, not $3$. $\endgroup$
    – Meow
    Feb 22, 2013 at 15:24
  • 1
    $\begingroup$ A standard deviation of $46.6$ sounds quite believable for data that is scattered between $-100$ and $100$. If the data were truly uniform, it would be about $57.73$ $\endgroup$ Feb 22, 2013 at 20:50

1 Answer 1


If your data is a sample, you should use the sample variance


as it is an unbiased estimator (note the n-1 in the denominator). The standard deviation is given as described above by $s=\sqrt{s^2}$. As Alyosha mentioned, do not use the absolute numbers, but the real values of x given by the experiment.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .