[R] squared euclidean distance

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Oct 21 19:44:33 CEST 2009


On Wed, 2009-10-21 at 17:35 +0200, Caro B. wrote:
> Dear R-Help-Team,
> 
> 
> I would like to cluster my data using the ward-method. In several papers I
> read (e.g. Bahrenberg) that it is neccesary to use the "squared euclidean
> distance" with the ward-method. Unfortunatelly I cannot find this term in r
> as a method for measuring the distance.
> 
> Does anybody have an idea?

Compute the Euclidean distance then square the numbers to undo the sqrt
applied within dist.

set.seed(1)
dat <- data.frame(X1 = runif(10), X2 = runif(10))
d.euc <- dist(dat)
d.sqeuc <- d.euc^2
class(d.sqeuc) ## still a dist object

I have no idea what/who Bahrenberg is or whether/why it is advisable to
use this sq Euclidean with Ward's method; in my field I've seen Ward's
method used with all sorts of distance coefficients...

HTH

G

> 
> Thanks in advance,
> Carolin
> 
> 	[[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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list