1.4.8 A Cox fit
With #:family 'cox, the response is (surv time status). A Cox model has no intercept, so its coefficients are the predictors’ alone, and #:type 'response predicts the relative risk:
> (define survival-cv (formula-cv (~ (surv time status) age dose marker) patients #:family 'cox)) > survival-cv
#<glmnet-cv:cox (~ (surv time status) age dose marker) Partial Likelihood Deviance
Lambda Index Measure SE Nonzero
min 0.04704 24 5.425 0.4747 2
1se 0.3997 1 5.868 0.4361 1>
> (coef survival-cv) '(("age" . 0.0) ("dose" . 0.0) ("marker" . 0.142722357683114))
> (coef survival-cv #:lambda 'lambda-min) '(("age" . 0.03435201616582482) ("dose" . 0.0) ("marker" . 1.691711581027472))
> (predict survival-cv new-patients #:type 'response #:lambda 'lambda-min) '(9.206745640260905 4.7530444096829685)
At lambda-1se, the model keeps only the marker, the stronger of the two predictors that the survival time depends on; at lambda-min it adds age. Both drop the dose.