I am trying to run the code glmnet(M, R, family="binomial")
, where M is a data matrix of size (N by k) and R is a N-dimensional vector of binary values. N is the number of samples and k is the number of variables. In my specific case, R is simply a vector of ones because it is the only response I have for my dataset.
As noted in some other answers, when R contains all ones or all zeroes, glmnet
throws the following error:
"Error in y %*% rep(1, nc) : non-conformable arguments"
Why is this the case, and is there a way to circumvent this error? glm
does not throw this error but severely overfits for my dataset, so I need to use glmnet
for regularization purposes.
I can provide sample code if needed.
Thanks.