I have a matrix of 40 observations and 747 variables, which are frequencies with a certain number of zeros. My observations are divided into two groups, resume in the vector "rep_pdrp".
I want to select variables with good discriminant and predictive performance. So I decided to use caret and glmnet R packages as described here : https://quantmacro.wordpress.com/2016/04/26/fitting-elastic-net-model-in-r/
lambda.grid <- seq(0, 100) alpha.grid <- seq(0, 0.5, length = 6) trnCtrl = trainControl( method = "repeatedCV", number = 10, repeats = 5) srchGrd = expand.grid(.alpha = alpha.grid, .lambda = lambda.grid) my.train <- train(x = data.matrix(my.data), y = rep_pdrp, method = "glmnet", tuneGrid = srchGrd, trControl = trnCtrl, standardize = FALSE, maxit = 1000000) plot(my.train) my.glmnet.model <- my.train$finalModel sum(coef(my.glmnet.model, s = my.train$bestTune$lambda)!=0)
The "bestTune" parameter are alpha = 0.1 and lambda = 100. When I run again with a larger lambda.grid, it's always the max of lambda which is given in the output... Do you know what is the issue ?
Moreover, all coefficients equal zero, except the intercept. I don't understand why. Have you good an idea of the problem?