R语言
xclara
位于 cluster
包(package)。 说明
一个人工数据集,由 3 个 well-separated 簇中的 3000 个点组成。
用法
data(xclara)
格式
一个 DataFrame ,对 2 个数值变量(名为 V1
和 V2
)进行 3000 个观测,分别给出点的 和 坐标。
注意
我们的 xclara
版本比 read.table("xclara.dat")
版本稍微更圆润,all.equal
测量的相对差异是 1.15e-7
(对于 V1
)和 1.17e-7
(对于 V2
),这表明我们的版本已options(digits = 7)
格式化的结果。
此前(2017 年 5 月之前),据称这三个簇的大小均为 1000,这显然是错误的。 pam(*, 3)
给出的簇大小为 899、1149 和 952,除了七个 “outliers” (或 “mislabellings”)对应于观察索引 、 和 ,请参见示例。
例子
## Visualization: Assuming groups are defined as {1:1000}, {1001:2000}, {2001:3000}
plot(xclara, cex = 3/4, col = rep(1:3, each=1000))
p.ID <- c(78, 1411, 2535) ## PAM's medoid indices == pam(xclara, 3)$id.med
text(xclara[p.ID,], labels = 1:3, cex=2, col=1:3)
px <- pam(xclara, 3) ## takes ~2 seconds
cxcl <- px$clustering ; iCl <- split(seq_along(cxcl), cxcl)
boxplot(iCl, range = 0.7, horizontal=TRUE,
main = "Indices of the 3 clusters of pam(xclara, 3)")
## Look more closely now:
bxCl <- boxplot(iCl, range = 0.7, plot=FALSE)
## We see 3 + 2 + 2 = 7 clear "outlier"s or "wrong group" observations:
with(bxCl, rbind(out, group))
## out 1038 1451 1610 30 327 562 770
## group 1 1 1 2 2 3 3
## Apart from these, what are the robust ranges of indices? -- Robust range:
t(iR <- bxCl$stats[c(1,5),])
## 1 900
## 901 2050
## 2051 3000
gc <- adjustcolor("gray20",1/2)
abline(v = iR, col = gc, lty=3)
axis(3, at = c(0, iR[2,]), padj = 1.2, col=gc, col.axis=gc)
来源
示例数据集附有以下参考文献(文件‘xclara.dat' 里面 'clus_examples.tar.gz’)。
参考
Anja Struyf, Mia Hubert & Peter J. Rousseeuw (1996) Clustering in an Object-Oriented Environment. Journal of Statistical Software 1. doi:10.18637/jss.v001.i04
相关用法
- R summary.clara “clara”对象的摘要方法
- R diana 分裂分析聚类
- R pluton 钚同位素成分批次
- R votes.repub 总统选举中共和党候选人的投票
- R agnes 凝聚嵌套(层次聚类)
- R print.mona MONA 对象的打印方法
- R print.clara CLARA 对象的打印方法
- R mona 二元变量的单论分析聚类
- R plot.diana 分裂层次聚类图
- R plot.mona 一元分裂层次聚类的旗帜
- R bannerplot 绘图横幅(层次聚类)
- R plot.partition 数据集分区图
- R summary.agnes “agnes”对象的摘要方法
- R pltree 绘制层次聚类的聚类树
- R summary.mona “mona”对象的摘要方法
- R plantTraits 植物物种性状数据
- R plot.agnes 凝聚层次聚类图
- R print.agnes AGNES 对象的打印方法
- R chorSub Kola 数据 C 范围的子集
- R pam 围绕 Medoid 进行分区
- R volume.ellipsoid 计算(椭球体的)体积
- R clusplot (分区对象的)双变量聚类图
- R print.pam PAM 对象的打印方法
- R clara 集群大型应用程序
- R agnes.object 聚合嵌套 (AGNES) 对象
注:本文由纯净天空筛选整理自R-devel大神的英文原创作品 Bivariate Data Set with 3 Clusters。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。