Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nashutoing/6327dfb724ad8f52994f68d6574cee70 to your computer and use it in GitHub Desktop.
Save nashutoing/6327dfb724ad8f52994f68d6574cee70 to your computer and use it in GitHub Desktop.
dendrogram for Central league and Pacific league
NPB18cebaZ<- scale(NPB18ceba[4:25]) #standardization
distZ<- data.frame(NPB18cebaZ) #?
distZ<- dist(NPB18cebaZ) #dcalculate distance,default method =euclidean
hclust(distZ) #clustering
summary(hclust(distZ))
plot(hclust(distZ)) #dendrogram
a<- hclust(distZ,method = "average")
hclust(distZ)$merge
par(mfrow=c(1,2)) #to compare
plot(hclust(distZ),main = "default complete:最遠隣法")
plot(a,main = "average:群平均法")
b<- hclust(distZ,method="centroid")
plot(b,main = "centroid:重心法")
c<- hclust(distZ,method="ward")
plot(c,main= "ward.D:ウォード法")
d<- hclust(distZ,method="ward.D2")
plot(d,main="ward.D2")
NPB18pabaZ<- scale(NPB18paba[4:25])
distpabaZ<- dist(NPB18pabaZ)
hclust(distpabaZ)
plot(hclust(distpabaZ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment