Florian NYC
Florian NYC

Reputation: 23

caret::varImp for GLM model worked before and gives me an error

I want to use "varImp" from the caret package. It worked before and I am unsure why it won`t work anymore. I applied it on a log-model.

log_model_logit <- glm(f_status_loan ~ ., family = binomial(link = logit), data = training_set)

However, I get an error

'could not find function "varImp"' when I apply

varImp(log_model_probit)

I also get an error when I apply

caret::varImp(log_model_probit)

I am not sure what to do about the error except deleting all my packages and installing afresh. I would appreciate if someone could help me and knows how to solve this issue.

Your help is much appreciated.

Upvotes: 0

Views: 310

Answers (1)

Florian NYC
Florian NYC

Reputation: 23

It works when you add scale = FALSE or scale = TRUE in brackets as follows

var_imp_log <- caret::varImp(log_model_probit) %>% as.data.frame() 

I am still unsure why it stopped working without it but I am happy that it is working now. I hope somebody else could help this as well. Would have saved me about 1.5 hours

Upvotes: 0

Related Questions