Dear R list,

My question:

I'm trying to calculate Mahalanobis distances for 'Species' from the iris data 
set as below:

cat('\n')
cat('Cluster analyse of iris data\n')
cat('from Mahalanobis distance obtained of SAS\n')
cat('\n')

n   = 3
dat = c(        0,
               89.86419,               0,
              179.38471,        17.20107,       0)

D = matrix(0, n, n)

nam = c('Set', 'Ver', 'Vir')
rownames(D) = nam
colnames(D) = nam

k = 0
for (i in 1:n) {
   for (j in 1:i) {
      k      = k+1
      D[i,j] = dat[k]
      D[j,i] = dat[k]
   }
}

D=sqrt(D) #D2  -> D

dendroS = hclust(as.dist(D), method='single')
dendroC = hclust(as.dist(D), method='complete')

win.graph(w = 3.5, h = 6)
split.screen(c(2, 1))
screen(1)
plot(dendroS, main='Single', sub='', xlab='', ylab='', col='blue')

screen(2)
plot(dendroC, main='Complete', sub='', xlab='', col='red')


I'm not fouding how to make it in the CRAN documentation (Archives, packages: 
mclust, cluster, fpc and mva).

Could help me?

Regards,
-- 
Jose Claudio Faria
Brasil/Bahia/UESC/DCET
Estatistica Experimental/Prof. Adjunto
mails:
  [EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch 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 via email to