你好,JMP 社区
有没有办法使用通用尺度来执行 PCA,就像使用 K 均值聚类一样?
我之所以问这个问题,是因为常用的 K 均值聚类方法更适合我的数据,但我想删除聚类数据,只显示带轴的 PCA 双标图
最好的,
谢谢你。我渴望有一天脚本比 GUI 更自然,但在这里我使用 JMP 而不是 R...
PCA 从相关矩阵开始。 如果选择协方差矩阵,则 PCA 双图匹配 K 均值集群双图(通用尺度),并且可以确定轴方差
来自 JMP 用户手册
显然,PCA 的协方差矩阵与 K-means 聚类的常用尺度相同
添加到@Dan_Obermiller评论,我相信 K Means 确实在使用该选项时将列居中而不是对其进行缩放,因此要使用 PCA 复制分析,您需要先将列居中,然后再进行未缩放的 PCA。如果您在双变量得分图下方运行脚本,则应该匹配。
Names default to here(1);
dt = Open( "$Sample_data/Lipid Data.jmp" );
//Center columns
dt << New Column("Age Centered", Numeric, "Continuous", Format("Best", 10), Formula(:Age - Col Mean(:Age)));
dt << New Column("Weight Centered", Numeric, "Continuous", Format("Best", 10), Formula(:Weight - Col Mean(:Weight)));
dt << New Column("Cholesterol Centered", Numeric, "Continuous", Format("Best", 10), Formula(:Cholesterol - Col Mean(:Cholesterol)));
dt << New Column("Triglycerides Centered", Numeric, "Continuous", Format("Best", 10), Formula(:Triglycerides - Col Mean(:Triglycerides)));
//Window with both analyses:
New Window( "Compare",
H List Box(
//K Means common scale:
dt << K Means Cluster(
Y( :Age, :Weight, :Cholesterol, :Triglycerides ),
Columns Scaled Individually( 0 ),
{Single Step( 0 ), Number of Clusters( 3 ), K Means Cluster,
Go( Show Biplot Rays( [0, 0, 1] ), Biplot( 1 ) )}
),
//PCA unscaled using centered columns
dt << Principal Components(
Y( :Age Centered, :Weight Centered, :Cholesterol Centered, :Triglycerides Centered ),
Estimation Method( "Default" ),
"on Unscaled"
)
)
);来自 K-Means 的 JMP 帮助:
单独缩放的列
独立于其他列缩放每一列。 当变量不具有共同的测量尺度,并且您不希望一个变量主导聚类过程时使用。 例如,一个变量的值可能介于 0 和 1000 之间,而另一个变量的值可能介于 0 和 10 之间。 在这种情况下,您可以使用该选项使聚类过程不受第一个变量的支配。
如果您不单独缩放它们,那么您就没有缩放变量。
如果您想在主成分中重现它,请选择未缩放的主成分(可从主成分的红色弹出菜单中获得)。 但是,请记住,所有变量都应该在相似的范围内,以使这些结果有意义。
Hi the scaling on the PCA is the same as the K-means when the "columns scaled individually" option is selected
但是当未选择“列单独缩放”选项时,我无法找到一种方法来使用 PCA 执行常见缩放,就像 Kmeans 可以做到的那样
我需要这样做的原因是因为 K-means 双图不包括轴解释的方差。如果有人知道如何让 K-means 图显示该值,我将不胜感激!
我可能不理解这个问题,但是当您对相关性执行 PCA 时,PCA 会自动居中并缩放所有变量。 因此,所有变量都在同一尺度上。