I am running the following elastic net model on binary data (1=bad, 0 = Good). Does anyone know what type of model does glmnet fit by default: P(y=1) or P(y=0). Is there anyway to choose the former to fit the model.
cv.glmnet(x, y, family="binomial", type.measure="deviance", standardize=FALSE, nfolds=5, alpha=par)
Buried within the glmnet documentation is your answer (type
?predict.glmnet
within R):If the binary data you described was assigned to
y
as a simple numeric vector, then the model will produce a P(y=1) fit.To invert and fit against P(y=0) instead, you just have to reorder the levels: