我目前正在执行分级群集。我选择使用FactoMineR是因为它有一个很好的数据探测管道: data->MFA->HCPC。
data("wine")
names(wine)
res<-MFA(wine,group = c(2,5,3,10,9,2),type=c("n",rep("s",5)),
ncp=5,name.group = c("orig","olf","vis","olfag","gust","ens"),
num.group.sup = c(1,6))
res.hcpc<-HCPC(res, nb.clust=0, consol=F, iter.max=10, min=3,
max=NULL, metric="euclidean", method="ward", order=TRUE,
graph.scale="sqrt-inertia", nb.par=5, graph=TRUE, proba=0.05,
cluster.CA="rows",kk=Inf)
#Now for some nice plots
plot(res.hcpc,draw.tree = T,choice = "tree")
plot(res.hcpc,draw.tree = T,choice = "bar")当我想要得到答案的时候,这些已经足够了,但是我想展示这些树。我想让他们在library(ape) - 示例上打扮一下
问题是这些函数需要一个hclust对象。我的一个选择是使用MFA结果并使用hclust函数作为:res.hc<-hclust(dist(res$global.pca$ind$coord),method = "ward.D2")来构建hclust对象。
这确实有效,但是我发现HCPC给出的信息更能提供更多的信息(答案与hclust不同)。因此,我希望使用HCPC对象,而不是hclust,但仍然能够使用library(ape)中的函数。想知道怎样才能把HCPC 胁迫给 hclust
发布于 2017-03-27 19:22:39
图书馆(Ape)
hcpcTree<-res.hcpc$call$t$tree
apeTree<-as.phylo(hcpcTree)用于库(Stats)
dendextendTree<-as.phylo.dendrogram(hcpcTree)https://stackoverflow.com/questions/36334536
复制相似问题