I am performing an elastic net regression on my data n = 34, p = 46
I first built the model using the "caret" package with the cross validation method to set the optimal alpha and lambda parameters
data.scale <- as.data.frame(scale(data))
set.seed(123)
model <- train(
value ~., data = data.scale, method = "glmnet",
trControl = trainControl("cv", number = 10),
tuneLength = 50)
Then I extracted the beta coefficients using the best lambda parameter
model$bestTune
coef(model$finalModel, model$bestTune$lambda)
and then, I tested the model performance on the entire dataset and calculated the RMSE and R2
x.test <- model.matrix(value ~., data.scale)[,-1]
predictions <- model %>% predict(x.test)
data.frame(
RMSE = RMSE(predictions, data.scale$value),
Rsquare = R2(predictions, data.scale$value)
)
Now I am trying to calculate the pvalues by bootstraping the model with the function boot.glmnet from the package "hdrm" with the following procedure
# divide explanatory variables and response variable in two separate dataframes
data.x <- data.scale %>%
dplyr::select(-value)
data.y <- data.scale %>%
dplyr::select(value)
# calculate confidence intervals
CI <- boot.glmnet(data.x, data.y$value,
alpha = 0.05,
lambda = model$bestTune$lambda,
B = 1000,
bar = T)
in CI results I am getting zeros for all confidence intervals lower and upper. I am now wondering where I am wrong. Is it a conceptual or scripting mistake? or maybe both? I would be very happy if anyone could clarify me this. I can provide the data if needed Thanks