[R] cluster with mahalanobis distance

Friedrich Leisch Friedrich.Leisch at stat.uni-muenchen.de
Thu Mar 4 12:46:59 CET 2010



Model-based clustering, e.g. using package mclust will do what you
want: it uses normal densities to calculate similarities of objects to
clusters, which is a monotone transformation of Mahalanobis distance
(basically what's inside the exp() of the multivariate Gaussian
density).

If you believe that Mahalanobis distance is the right one for your
data, then believing in a multivariate Gaussian model isn't too
far-fetched ...

Best,
Fritz



>>>>> On Wed, 3 Mar 2010 16:55:19 -0800 (PST),
>>>>> Phil Spector (PS) wrote:

  > Albyn -
  >     That's a very important fact that I overlooked in my 
  > original response.  Thanks for pointing it out.
  >                                                   - Phil


  > On Wed, 3 Mar 2010, Albyn Jones wrote:

  >> Note: this procedure assumes that all clusters have the same covariance matrix.
  >> 
  >> albyn
  >> 
  >> On Wed, Mar 03, 2010 at 01:23:37PM -0800, Phil Spector wrote:
  >>> The manhattan distance and the Mahalanobis distances are quite different.
  >>> One of the main differences is that a covariance matrix is necessary to
  >>> calculate the Mahalanobis
  >>> distance, so it's not easily accomodated by dist.  There is a function in
  >>> base R which does calculate the Mahalanobis
  >>> distance -- mahalanobis().  So if you pass a distance matrix
  >>> calculated by mahalanobis() to the clustering function, you'll
  >>> get what you want.
  >>> - Phil Spector
  >>> Statistical Computing Facility
  >>> Department of Statistics
  >>> UC Berkeley
  >>> spector at stat.berkeley.edu
  >>> 
  >>> 
  >>> On Wed, 3 Mar 2010, Tal Galili wrote:
  >>> 
  >>>> when you create the distance function to put into the hclust, use:
  >>>> 
  >>>> dist(x, method = "manhattan")
  >>>> 
  >>>> 
  >>>> Tal
  >>>> 
  >>>> 
  >>>> 
  >>>> ----------------Contact
  >>>> Details:-------------------------------------------------------
  >>>> Contact me: Tal.Galili at gmail.com |  972-52-7275845
  >>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
  >>>> www.r-statistics.com (English)
  >>>> ----------------------------------------------------------------------------------------------
  >>>> 
  >>>> 
  >>>> 
  >>>> 
  >>>> On Wed, Mar 3, 2010 at 9:14 PM, naama <nwolf at technion.ac.il> wrote:
  >>>> 
  >>>>> 
  >>>>> How can I perform cluster analysis using the mahalanobis distance instead
  >>>>> of
  >>>>> the euclidean distance?
  >>>>> thank you
  >>>>> Naama Wolf
  >>>>> 
  >>>>> --
  >>>>> View this message in context:
  >>>>> http://n4.nabble.com/cluster-with-mahalanobis-distance-tp1577038p1577038.html
  >>>>> Sent from the R help mailing list archive at Nabble.com.
  >>>>> 
  >>>>> ______________________________________________
  >>>>> R-help at r-project.org mailing list
  >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
  >>>>> PLEASE do read the posting guide
  >>>>> http://www.R-project.org/posting-guide.html
  >>>>> and provide commented, minimal, self-contained, reproducible code.
  >>>>> 
  >>>> 
  >>>> [[alternative HTML version deleted]]
  >>>> 
  >>>> ______________________________________________
  >>>> R-help at r-project.org mailing list
  >>>> https://stat.ethz.ch/mailman/listinfo/r-help
  >>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  >>>> and provide commented, minimal, self-contained, reproducible code.
  >>>> 
  >>> 
  >>> ______________________________________________
  >>> R-help at r-project.org mailing list
  >>> https://stat.ethz.ch/mailman/listinfo/r-help
  >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  >>> and provide commented, minimal, self-contained, reproducible code.
  >>> 
  >>



More information about the R-help mailing list