SIS r glm.fit(cbind(ones,x [,index],x [,condind]),y,family = gaussian())中的错误:NA / NaN / Inf in'x'

时间:2019-06-10 00:19:57

标签: r sis

我正在使用SISR。我的数据是数值的,包括响应变量。 它具有651列。我对其进行了标准化,然后将其转换为矩阵形式。

库(“ SIS”)

model1 <- SIS(GTGTm, gGTym, family = "gaussian", penalty = "lasso",
              tune = "bic", nfolds = 10,perm = FALSE,varISIS= "cons",  nsis = 10,
              standardize = TRUE)

我的数据中没有任何NA。但是我收到以下错误消息。请帮忙!但是,它正在使用as.matrix创建空间,所以我不知道如何修复它。

GT = read.csv("train.csv")
GTy = read.csv("trainy.csv")

x <- as.matrix(GT[,])
y <- as.matrix(GTy[,])

With str(x)
 chr [1:129, 1:651] " 44" " 55" " 58" " 39" "100" " 85" " 38" " 58" " 80" ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:651] "Automotive.Industry" "Commercial.Vehicles" "Motorcycles" "SUVs" ...

model1 <-SIS(GTGTm,gGTym,family =“ gaussian”,惩罚=“ lasso”, + tune =“ bic”,nfolds = 10,烫发= FALSE,varISIS =“ cons”,nsis = 10, +标准化= TRUE) Iter 1,筛选:62191212223227237 Iter 1,选择:191212227 glm.fit(cbind(ones,x [,index],x [,condind]),y,family = gaussian())中的错误:   NA / NaN / Inf in'x' 另外:警告消息: 在storage.mode(x)<-“ numeric”中:强制引入的NAs

1 个答案:

答案 0 :(得分:0)

我发现解决方案最好使用data.matrix而不是as.matrix。