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

时光毁灭记忆、已成空白 提交于 2021-01-29 07:21:12

问题


I am using SIS R. My data is numerical including the response variable. It has 651 Columns. I standardized it and convert it to matrix form.

library("SIS")

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

I don't have any NA in the data. But I am getting the following error message. Please help! But,it is creating the space with as.matrix so I don't know how to fix it.

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", penalty = "lasso", + tune = "bic", nfolds = 10,perm = FALSE,varISIS= "cons", nsis = 10, + standardize = TRUE) Iter 1 , screening: 62 191 212 223 227 237 Iter 1 , selection: 191 212 227 Error in glm.fit(cbind(ones, x[, index], x[, condind]), y, family = gaussian()) : NA/NaN/Inf in 'x' In addition: Warning message: In storage.mode(x) <- "numeric" : NAs introduced by coercion


回答1:


I found the solution it is better to use data.matrix instead of as.matrix.



来源:https://stackoverflow.com/questions/56519295/sis-r-error-in-glm-fitcbindones-x-index-x-condind-y-family-gaussi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!