所以不久前我遇到了类似的问题,有人建议我减少我的数据集,我已经做了很多。起初我有 1664 个变量,现在只有 153 个。我试图在一个称为保留时间的因变量与 153 个描述符之间绘制一个一般线性模型。我有 160 个针对描述符的保留时间示例,因此它是一个 160 x 153 的数据集。然后我想对模型执行五折交叉验证,看看它有多准确,然后绘制预测保留时间到实验保留时间图。我正在使用 CVtools 来执行此操作。
> library(cvTools)
> cadets <- read.csv("U:/Final Year/CADETS.csv")
> View(cadets)
> folds <- cvFolds(nrow(cadets), K = 5, R = 10)
> fit <- lm(RT..seconds.~., data=cadets)
> folds <- cvFolds(nrow(cadets), K = 5, R = 10)
> repCV(fit, cost = rtmspe, folds = folds, trim = 0.1)
但是,我收到消息:-
There were 50 or more warnings (use warnings() to see the first 50)
1: In predict.lm(...) : prediction from a rank-deficient fit may be misleading
2: In predict.lm(...) : prediction from a rank-deficient fit may be misleading
3: In predict.lm(...) : prediction from a rank-deficient fit may be misleading
它继续。我在某处读到这可能是由于数据是共线的。因此,如果是这种情况,我决定执行 PCA,结果发现在我将组件绘制在一起后,它们都指向不同的方向,这表明它们不是共线的。
谁能理解发生了什么以及我哪里出错了?我已经复制并粘贴了我正在使用的数据库的一小部分。所以我试图为所有 160 个案例绘制 RT(秒)与 76_TI2、114_DECC 和所有其他 151 个描述符并对其执行交叉验证。
RT (seconds) 76_TI2 114_DECC 120_Lop 212_PCD
38 4.086 1.2 2.322 0
40 2.732 0.815 1.837 1.113
41 4.049 1.153 2.117 2.354
41 4.049 1.153 2.117 3.838
42 4.56 1.224 2.128 2.38
42 2.96 0.909 1.686 0.972
42 3.237 0.96 1.922 1.202
44 2.989 0.8 1.761 2.034
44 1.993 0.5 1.5 0
44 2.957 0.8 1.761 0.988
44 2.597 0.889 1.888 1.916
44 2.428 0.691 1.436 1.848
44 4.049 1.153 2.117 2.354
44 3.108 0.826 1.686 1.826
44 2.416 1 0.714 28.876
44 2.395 0.778 1.73 2.532
45 1.28 0.75 1.124 0
45 1.27 0.625 1.124 0
45 2.666 0.833 1.792 0