Helper function to add strata as an attribute to a Surv object. The
output of this function can be used as the response in
for fitting stratified Cox models.
A Surv object.
A vector of length equal to the number of observations in y, indicating strata membership. Default is all belong to same strata.
An object of class
stratifySurv (in addition to all the
y belonged to).
When fitting a stratified Cox model with
glmnet(), strata should
be added to a
Surv response with this helper function. Note that
it is not sufficient to add strata as an attribute to the
response manually: if the result does not have class
subsetting of the response will not work properly.