0

I want to understand why Matlab is giving me a wrong answer when I ask for the standard deviation. For example, I was trying to get the standard deviation of this matrix:

It doesn't make sense, because the first column $[1;4;7]$ gives me $3$ and the standard deviation is $\sqrt6$. I stuck there and I didn't even try to calculate the other standard deviations. What is happening? is Matlab using another formula for standard deviation other than the classical one? or it's rounding the number $\sqrt6$ to $3$? I need help, thank you!

user42912
  • 23,582
  • Matlab is using the unbiaised estimator. You can't imagine that Matlab would give a wrong result for such a common function. –  Apr 30 '20 at 13:52
  • @YvesDaoust yes, I've never said it gave me a wrong result – user42912 Apr 30 '20 at 14:03
  • Didn't you say "Matlab is calculating the standard deviation wrongly" and "Matlab is giving me a wrong answer" somewhere ? Don't be bad faith. –  Apr 30 '20 at 14:04
  • @YvesDaoust maybe the question is misleading, I will edit my title. Thank you! – user42912 Apr 30 '20 at 14:06

1 Answers1

2

Matlab uses the sample standard deviation. That is, it divides by $n-1$ rather than $n$ to estimate the variance, because this gives an unbiased estimator of the variance. Taking the square root then gives the sample standard deviation.

Unfortunately, an unbiased estimator of the variance does not lead to an unbiased estimator of the standard deviation.

Dasherman
  • 4,206
  • what do you mean by unbiased estimator of the variance? thank you for your answer – user42912 Apr 30 '20 at 14:02
  • @user42912 Are you familier with the concept of an estimator? Unbiased means that the expectation of the estimator is equal to the parameter we wish to estimate. – Dasherman Apr 30 '20 at 14:04
  • No, could you give me some sources to study further – user42912 Apr 30 '20 at 14:08
  • @user42912 This is basically intro to statistics stuff, so you can read pretty much any introductory statistics (or econometrics) text, as long as it's not just a bunch of test recipes but instead goes into more mathematical detail. Some examples are Statistical Inference by Casella and Berger (Chapter 7) or Stock and Watson's Introduction to econometrics (Chapter 3). – Dasherman Apr 30 '20 at 22:13