我正在使用 cv.glmnet
对一个包含基因型的二元数据集进行分析,以预测连续性变量的表型。数据大致如下,但包含超过 200 个基因:
Pheno K00074 K00100 K00179 K00180
1 18.063630 0 0 0 0
2 16.746644 0 0 0 0
3 16.016194 1 0 0 0
4 -1.469207 1 1 0 0
5 -3.047956 1 0 1 1
6 15.274531 1 0 0 0
我使用 cv.glmnet
和 predict
的代码如下:
cv.lasso <- cv.glmnet(x = as.matrix(zx), y = unlist(zy), alpha = 1,
type.measure = 'mse',keep = TRUE) # runs the model
prediction<-predict(cv.lasso,s = cv.lasso$lambda.1se,
newx = as.matrix(batch1218.kegg[,-1]),type = 'class')
其中zx
是基因存在/缺失的二进制列,zy
是表型列。batch1218.kegg
是我想用来预测表型的新的基因型数据。然而,我的预测结果看起来像这样:
1
1 6.438563
2 6.438563
3 6.438563
4 6.438563
5 6.438563
6 6.438563
每一行的数字都相同。其他表型也出现了相同的情况。我想问题可能是我只使用了大约38行表型数据,相对于大量的预测变量。但我想要确定是否存在其他问题。
dput
(例如您在此处提供的6行)- 我们需要一些zx
、zy
和batch1218.kegg
来尝试解决问题。 - Andy Baxter