r - How to force step() to keep running even if a step fails to converge -


i attempting run forwards stepwise regression large set of features. however, whenever step() function computes possible step not converge, throws error:

step = step(glm, scope = fmla, direction = "both", trace = 5)  error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  :    na/nan/inf in 'x' in addition: warning message: step size truncated due divergence  

instead of ignoring possible step not converge , continuing looking @ other steps, stops whole process. note, makes through few successful steps before throwing error. work around of issue appreciated!

edit

data('mtcars') mtcars[1:12,10] = inf head(mtcars) lm = glm(mpg~gear, data = mtcars, family = "gaussian") fmla <- as.formula(paste("~", paste(colnames(dplyr::select(mtcars, -mpg)),    collapse= "+"))) steptest = step(lm, scope = fmla, trace = 1) 

this example of step() failing continue because 1 step resulted in error. ignore error , step , continue. thoughts? not looking correct na/nan/inf error, have step push past glm() failures.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -