I am getting an error that I can't trace when running the cv.glmnet function.
Research only hinted me to the approx() function that throws the error when searching for lambda but I am not familiar enough with glmnet to figure out how it connects.
The error is: "need at least two non-NA values to interpolate"
While the solution seems obvious, I am working with simulated data, so definitely no NAs in there. I double-checked multiple times. I also dropped columns with constant variables in one attempt but didn't help either.
Reproducible example is a bit messy due to the complexity of the data (and also not minimal since the error doesn't occur in small example data) but please see below:
pacman::p_load(glmnet,RCurl)
url <- getURL('https://raw.githubusercontent.com/oliverkostorz/MC-Simulation-Ensemble-Methods-Heterogeneous-Treatment-Effects/master/example.csv')
data <- read.csv(text = url)
x <- data[,3:ncol(data)]
y <- data[,2]
EN_fit <- cv.glmnet(x, y, type.measure = 'mse', alpha = .5)
Hope someone can help!
Best, Oliver