全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
9562 14
2012-04-09
悬赏 200 个论坛币 未解决
现在有一组数据需要进行聚类分析,要先计算出距离矩阵。

我现在需要的距离矩阵需要满足 dij = sqrt(2*(1-cij))
其中dij是距离矩阵中的元素;
cij表示数据集中两个变量间的相关系数,来自于通过数据集不同变量间计算corr 矩阵中的对应元素。

比如 数据集A:

x    y    z                                                                                x    y    z
1    4    5                可以计算得到一个corr矩阵                  x   1   *   *
3    1    2             ===================>            y   *    1    *
5    3    8                                                                           z    *   *     1

现在我要计算这个距离矩阵用于proc cluster,但是我不知道这个距离矩阵该怎么算比较好,如果用proc corr + proc iml 算效率会不会很差,因为我要算几百次这样的聚类。

好像proc distance能算这个矩阵,但是我不确定能不能直接用这个距离关系。
补充: 大家有没有别的方法可以计算出按照上述关系进行的聚类分析?

本人是初学者,希望各位高手多多帮忙。

谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-4-10 17:13:01
大家帮帮忙啊....真的不知道该怎么算...
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-4-10 18:24:32
用proc stdize对数据进行标准化,然后再跑proc cluster就可以了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-4-10 18:25:34
而且proc cluster可以选择不同的method,已经包括你所说的corr矩阵的问题
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-4-10 19:07:03
jason_huo 发表于 2012-4-10 18:25
而且proc cluster可以选择不同的method,已经包括你所说的corr矩阵的问题
高人能讲的具体点吗 我是个初学者,不是太了解这些过程。
十分感谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-4-10 19:16:15
dimxu 发表于 2012-4-10 19:07
高人能讲的具体点吗 我是个初学者,不是太了解这些过程。
十分感谢
要看呢具体做什么吧,如果你只关心结果而不是其中的算法,那样就用proc stdize对变量进行标准化,然后用proc cluster进行聚类,出来的结果就会准确。关于cluster中的method选择,可以参考下面的文档。如果你的数据量比较大的话,建议使用proc fastclus

PROC CLUSTER METHOD=name <options> ;
The PROC CLUSTER statement starts the CLUSTER procedure, specifies a clustering method, and optionally specifies details for clustering methods, data sets, data processing, and displayed output.

The METHOD= specification determines the clustering method used by the procedure. Any one of the following 11 methods can be specified for name:


AVERAGE  |  AVE
requests average linkage (group average, unweighted pair-group method using arithmetic averages, UPGMA). Distance data are squared unless you specify the NOSQUARE option.


CENTROID  |  CEN
requests the centroid method (unweighted pair-group method using centroids, UPGMC, centroid sorting, weighted-group method). Distance data are squared unless you specify the NOSQUARE option.


COMPLETE  |  COM
requests complete linkage (furthest neighbor, maximum method, diameter method, rank order typal analysis). To reduce distortion of clusters by outliers, the TRIM= option is recommended.


DENSITY  |  DEN
requests density linkage, which is a class of clustering methods using nonparametric probability density estimation. You must also specify either the K=, R=, or HYBRID option to indicate the type of density estimation to be used. See also the MODE= and DIM= options in this section.


EML
requests maximum-likelihood hierarchical clustering for mixtures of spherical multivariate normal distributions with equal variances but possibly unequal mixing proportions. Use METHOD=EML only with coordinate data. See the PENALTY= option for details. The NONORM option does not affect the reported likelihood values but does affect other unrelated criteria. The EML method is much slower than the other methods in the CLUSTER procedure.


FLEXIBLE  |  FLE
requests the Lance-Williams flexible-beta method. See the BETA= option in this section.


MCQUITTY  |  MCQ
requests McQuitty’s similarity analysis (weighted average linkage, weighted pair-group method using arithmetic averages, WPGMA).


MEDIAN  |  MED
requests Gower’s median method (weighted pair-group method using centroids, WPGMC). Distance data are squared unless you specify the NOSQUARE option.


SINGLE  |  SIN
requests single linkage (nearest neighbor, minimum method, connectedness method, elementary linkage analysis, or dendritic method). To reduce chaining, you can use the TRIM= option with METHOD=SINGLE.


TWOSTAGE  |  TWO
requests two-stage density linkage. You must also specify the K=, R=, or HYBRID option to indicate the type of density estimation to be used. See also the MODE= and DIM= options in this section.


WARD  |  WAR
requests Ward’s minimum-variance method (error sum of squares, trace W). Distance data are squared unless you specify the NOSQUARE option. To reduce distortion by outliers, the TRIM= option is recommended. See the NONORM option.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群