Am 27.01.2013 12:43, schrieb Pindar:
Hi,
there is a strange behavior when combining the 'sd' function with matrices:
1) I thought it flags an error - is it now allowed for matrices?
2) the result is not correct, but the 'var' function works with this
simple matrix in the example
<hansl>
matrix test = {-0.08142857;0.05560000}
eval mcov(test)
eval var(test)
eval sqrt(mcov(test))
eval sqrt((test[1]-mean(test))^2 + (test[2]-mean(test))^2)
eval sd(test)
<hansl>
Without having verified numerically, I suspect this is an issue of 1/n
versus 1/(n-1). If so, then "correct" is not unique in this case; as you
know, the first is ML, the second is unbiased. In this extreme case of
n=2 this will lead to very different results (factor of 1/sqrt(2) I guess).
hth,
sven