Error in if (nulldev == 0) stop("y is constant; gaussian glmnet fails at standardization step") : missing value where TRUE/FALSE needed In addition: Warning message: In storage.mode(y) <- "double" : NAs introduced by coercion

Hello,

Trying to train a multinomial regression classifier using lasso penalty. Values of 0, 1, and 2 represent the genotypes for a sample of 242 individuals under positions 1 through 49 (labeled as pos1 through pos 49). The genotypes correspond to a specific ancestry.

Libraries: tidyverse, glmnet

Code:

Y <- train %>%
select(ancestry) %>%
na.omit() %>%
as.matrix()
head(Y)

X <-train %>%
select(pos1:pos49)%>%
as.matrix()
head(X)

#Specifying the set of tuning parameter (휆) values
lambdas <-10^seq(-3, 3, length.out= 500)

lasso.fit<-glmnet(X, Y, alpha = 1, lambda = lambdas)

Error:
Error in if (nulldev == 0) stop("y is constant; gaussian glmnet fails at standardization step") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In storage.mode(y) <- "double" : NAs introduced by coercion

any suggestions?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.