我正在尝试使用以下代码对库中的GenCont数据进行岭回归j = 0
x = 9970024
total = 249250621
while (j <= total):
for i in range(j,x):
j = j +1
j = i+1
x = x+j
ridge
但如果我在模型中使用虚拟变量,我会收到此错误
library(ridge)
data(GenCont)
GenCont_df <- as.data.frame(GenCont)
GenCont_df$SNP1 <- as.factor(GenCont_df$SNP1)
mod2 <- linearRidge(Phenotypes ~ SNP1+SNP2, data = GenCont_df)
predict(mod2, GenCont_df, na.action = na.pass, all.coef = FALSE,scaling ="scale")
有没有办法在R?
中的岭回归中预测虚拟变量