问题
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