I have tuned a glm net model with caret using the train function. I am trying to extract the coefficients and standard errors of those coefficients for the best tuned model. Following this CV post I figured out how extract the coefficients. As such, I use
coef <- as.matrix(coef(model$finalModel, model$bestTune$lambda))
to extract the coefficients. However, I cannot figure out how to get the standard errors. I tried
se.coef <- as.matrix(se.coef(model$finalModel, model$bestTune$lambda)) from the "arm" library but it threw the following error:
Error in as.matrix(se.coef(model$finalModel, model$bestTune$lambda)) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘se.coef’ for signature ‘"lognet"’
Could anyone add any insight please? I understand that the se.coef may not work with the train function. However, is there another way to obtain the standard errors for the coefficients?