When I've used glmnet()
in the past, I have used model.matrix()
to create my x
input for glmnet(x, y, alpha = 1, family = 'binomial')
. However, I'm now trying to predict binary outcomes for data in which I have full observations for each of the predictors, but all my entries for the response are NA
. The model.matrix()
function does not appear to function when the response variables are all missing, and I've been trying to use data.matrix()
to construct an alternative x
input for glmnet()
. However, I keep getting the following error when I try to use the predict()
function:
Error in as.matrix(cbind2(1, newx) %*% nbeta) :
error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error in cbind2(1, newx) %*% nbeta :
Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90
Would anyone be able to suggest how to move forward in this scenario with all missing response values? I've tried using various sparse matrix functions after reading several online articles, but none seem to work. For example:
https://stat.ethz.ch/R-manual/R-devel/library/Matrix/html/sparseMatrix.html