1.4.7 A binomial fit
With #:family 'binomial, the response column holds 0/1 labels, or two classes as strings, symbols or booleans (see Categorical responses). Here the formula takes every column except the other responses:
> (define relapse-cv (formula-cv (~ relapse (- all bp time status)) patients #:family 'binomial)) > relapse-cv
#<glmnet-cv:binomial (~ relapse (- all bp time status)) Binomial Deviance
Lambda Index Measure SE Nonzero
min 0.009797 37 0.3976 0.1156 2
1se 0.03604 23 0.5025 0.08812 2>
> (coef relapse-cv)
'(("(Intercept)" . 0.8782313960189869)
("age" . 0.0)
("dose" . -0.5364786058863007)
("marker" . 4.33160821549671))
> (predict relapse-cv new-patients #:type 'response) '(0.8777268852046514 0.003760628144205349)
> (predict relapse-cv new-patients #:type 'class) '(1 0)
At lambda-1se, the model keeps the dose and the marker, the two predictors that the relapse depends on.