About help on 'mahalanobis'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

About help on 'mahalanobis'

Henrik Bengtsson-2
Hi,

help on 'mahalanobis' (in the stats package in Rv2.2.0) now says:

"Description:

      Returns the Mahalanobis distance of all rows in 'x' and the vector
      mu='center' with respect to Sigma='cov'. This is (for vector 'x')
      defined as

                  D^2 = (x - mu)' Sigma^{-1} (x - mu)"

It does return D^2 as written.  However, would the text be more clear if
it says "Returns the _squared_ Mahalanobis distance D^2..." instead?  If
so, then text in the example code, e.g. "##- Here, D^2 = usual Euclidean
distances" and the title of the first plot will also have to be updated.

Compare this with what dist() in the same package returns.  When asking
for the Equlidean distance (matrix) between rows in a matrix, we get D
not D^2, e.g. dist(c(1,3)) == 2.

Cheers

Henrik

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: About help on 'mahalanobis'

Martin Maechler
>>>>> "HenrikB" == Henrik Bengtsson <[hidden email]>
>>>>>     on Wed, 14 Dec 2005 17:05:32 +1100 writes:

    HenrikB> Hi,
    HenrikB> help on 'mahalanobis' (in the stats package in Rv2.2.0) now says:

    HenrikB> "Description:

    HenrikB> Returns the Mahalanobis distance of all rows in 'x' and the vector
    HenrikB> mu='center' with respect to Sigma='cov'. This is (for vector 'x')
    HenrikB> defined as

    HenrikB> D^2 = (x - mu)' Sigma^{-1} (x - mu)"

    HenrikB> It does return D^2 as written.  However, would the
    HenrikB> text be more clear if it says "Returns the
    HenrikB> _squared_ Mahalanobis distance D^2..." instead?  If
    HenrikB> so, then text in the example code, e.g. "##- Here,
    HenrikB> D^2 = usual Euclidean distances" and the title of
    HenrikB> the first plot will also have to be updated.

Indeed, thank you!
Committed {even to R-beta}.

    HenrikB> Compare this with what dist() in the same package
    HenrikB> returns.  When asking for the Equlidean distance
    HenrikB> (matrix) between rows in a matrix, we get D not
    HenrikB> D^2, e.g. dist(c(1,3)) == 2.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html