Annexe II
Tableau 17. Etapes de la classification ascendante hiérarchique CAH
Etape
Fonction
Charger les packages
require(cluster)
require(clue)
Importation du fichier
congre=read.table(file=file.choose(), dec=".", header=T, sep="\t")
congre1=scale(congre[,-1])
congre1=data.frame(congre1)
Distance euclidienne
d=round(dist(congre1,"euclidean"),2)
Réalisation
des
4
classifications.
hdw=hclust(d,method="ward")
hds=hclust(d,method="single")
hdc=hclust(d,method="complete")
hda=hclust(d,method="average")
Représentation
des
dendrogrammes dans une
même fenêtre.
par(mfrow=c(2,2))
plot(hdw, hang=-1, main="Ward",congre[,1])
plot(hds, hang=-1, main="Lien simple",congre[,1])
plot(hdc, hang=-1, main="Lien complet",congre[,1])
plot(hda, hang=-1, main="Lien moyen",congre[,1])
Création d'objets incluant
la matrice cophénétique
(ultramétrique)
entre
espèces
dcow=cophenetic(hdw)
dcos=cophenetic(hds)
dcoc=cophenetic(hdc)
dcoa=cophenetic(hda)
Identifier
quelle
classification est la plus
fidèle à l'information
initiale (la norme 2)
x11()
par(mfrow=c(2,2))
plot(d,dcow,xlim=c(0,max(d,dcow)),
ylim=c(0,max(d,dcow)),main="U-Ward vs D" )
abline(a=0, b=1, col = 3)
nw=round(cl_dissimilarity(d, dcow, method = "spectral"),2)
text(17, 3, "norme 2 =")
text(22, 3, nw)
plot(d,dcos,xlim=c(0,max(d,dcos)),
ylim=c(0,max(d,dcos)),main="U-lien simple vs D")
abline(a=0, b=1, col = 3)
ns=round(cl_dissimilarity(d, dcos, method = "spectral"),2)
text(6, 1, "norme 2 =")
text(7,1,ns)
plot(d,dcoc,xlim=c(0,max(d,dcoc)),
ylim=c(0,max(d,dcoc)),main="U-lien complet vs D" )
abline(a=0, b=1, col = 3)
nc=round(cl_dissimilarity(d, dcoc, method = "spectral"),2)
text(4, 1, "norme 2 =")
text(5, 1, nc)
plot(d,dcoa,xlim=c(0,max(d,dcoa)),
ylim=c(0,max(d,dcoa)),main="U-lien moyen vs D" )
abline(a=0, b=1, col = 3)
na=round(cl_dissimilarity(d, dcoa, method = "spectral"),2)
text(6, 1, "norme 2 =")
text(7, 1, na)
La norme 2 observée doit
être inférieure au seuil
sig=var(d)+var(dcoa)
th=2*sqrt(nrow(as.matrix(d))*sig)
Précédent

La famille des congridae ( Ostéichtyens, Anguilliformes) dans le bassin algérien - 139/150

Suivant