I have a question regarding the cv.lars. Bellow there is a description for the data I use:
is.numeric(Y$Y1)
[1] TRUE
length(Y$Y1)
[1] 589
dim(Training_XX[7:ncol(Training_XX)])
[1] 589 5677
I have already run lasso using lars package. My code is as follows:
LASSO_1<-lars(as.matrix(X[7:ncol(X)]),
Y$Y1,type=c("lasso"),
normalize=TRUE, use.Gram=FALSE).
The above procedure seems to run fine. However, when I'm trying to cross-validate for the lambda value, I get the following error:
Error in if (zmin < gamhat) { : missing value where TRUE/FALSE needed
My code for the cross-validation is:
CV<-cv.lars(as.matrix(X[7:ncol(X)]),Y$Y1,use.Gram=FALSE,max.steps=500)
lambda_Y1=CV$index[which.min(CV$cv)]
Does anyone has any idea what's going on? I really don't know what that error means and what's wrong with my data (and or code).