R-'princomp'只能用于比变量更多的单位 [英] R - 'princomp' can only be used with more units than variables

查看:901
本文介绍了R-'princomp'只能用于比变量更多的单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R软件(R指挥官)对我的数据进行聚类.我有一个较小的数据子集,包含200行和约800列.尝试kmeans聚类并在图形上绘制时,出现以下错误. 'princomp'只能用于比变量更多的单位"

I am using R software (R commander) to cluster my data. I have a smaller subset of my data containing 200 rows and about 800 columns. I am getting the following error when trying kmeans cluster and plot on a graph. "'princomp' can only be used with more units than variables"

然后我创建了一个10行和10列的测试文档,其中的图表可以正常显示,但是当我添加额外的列时,我再次遇到错误. 为什么是这样?我需要能够绘制我的群集.在执行kmeans后查看数据集时,我可以看到额外的结果列,其中显示了它们所属的群集.

I then created a test doc of 10 row and 10 columns whch plots fine but when I add an extra column I get te error again. Why is this? I need to be able to plot my cluster. When I view my data set after performing kmeans on it I can see the extra results column which shows which clusters they belong to.

如果我做错了什么,我可以摆脱这个错误并绘制更大的样本吗??? 请帮忙,现在已经让我头疼了一个星期. 谢谢大家.

IS there anything I am doing wrong, can I ger rid of this error and plot my larger sample??? Please help, been wrecking my head for a week now. Thanks guys.

推荐答案

问题是变量比采样点多,并且正在进行的主成分分析失败.

The problem is that you have more variables than sample points and the principal component analysis that is being done is failing.

princomp的帮助文件中进行了说明(请阅读?princomp):

In the help file for princomp it explains (read ?princomp):

 ‘princomp’ only handles so-called R-mode PCA, that is feature
 extraction of variables.  If a data matrix is supplied (possibly
 via a formula) it is required that there are at least as many
 units as variables.  For Q-mode PCA use ‘prcomp’.

这篇关于R-'princomp'只能用于比变量更多的单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆