0

So I noticed a discrepancy while computing a vol, i.e. standard deviation. I manually computed it as follows:

v <- c(9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4)
sqrt(sum((v - mean(v))^ 2) / length(v))
[1] 2.983287

Now if I try sd():

sd(v)
[1] 3.060788

It seems that what sd() is doing is:

sqrt(sum((v - mean(v))^ 2) / (length(v)-1))
[1] 3.060788

Why is it doing N - 1 for the denominator? The definition of stddev as I have always learned it specifies to use N as the denominator. What am I missing?

Denis
  • 11,796
  • 16
  • 88
  • 150
  • 2
    You are mixing up population vs sample sd. Sample sd uses N-1 – dww Apr 02 '19 at 19:29
  • can you elaborate in an answer? – Denis Apr 02 '19 at 19:30
  • 3
    See https://stats.stackexchange.com/questions/54/why-do-us-and-uk-schools-teach-different-methods-of-calculating-the-standard-dev and https://math.stackexchange.com/questions/15098/sample-standard-deviation-vs-population-standard-deviation – dww Apr 02 '19 at 19:31

0 Answers0