Well, I found a solution for lm
and glm
,
coefs_lm<-as.data.frame(lapply(lm_model,function(x)coef(x)[2:5]))
coefs_glm<-as.data.frame(lapply(glm_model,function(x)coef(x)[2:5]))
var_imp <- function(object, ...) {
var_imp_r <- object$variable.importance
var_imp_r
}
coefs_rf<-as.data.frame(lapply(rf_ranger,function(x)var_imp(x)[1:4]))
However, I'm still looking for a suitable solution2:5
for extractinglm
and glm
is the variable importance tablenumber of samples rf_rangerEE..
random forest models, where 1 is intercept.