View source: R/glmnetpostsurv.R
glmnetsurv | R Documentation |
Extends functionality of survival models in glmnet
to compute survival curves and other calibrations.
glmnetsurv( formula = formula(data), data = sys.parent(), family = "cox", alpha = 1, lambda = NULL, s = NULL, method = "breslow", x = FALSE, contrasts.arg = NULL, xlevs = NULL, na.action = na.omit, ... )
formula |
Object of class formula describing
the model. The response and terms are specified
similar to |
data |
optional data frame containing variables specified in the formula. |
family |
currently, only |
alpha |
the elasticnet mixing parameter, see |
lambda |
optional user supplied lambda sequence, see |
s |
a single value of lambda over which predictions or extractions are made. Ideally, this value should be obtained from |
method |
for ties handling. Currently, only "breslow" is implemented. |
x |
logical value. If |
contrasts.arg |
an optional list. See
the contrasts.arg of
|
xlevs |
a named list of character vectors
giving the full set of levels to be assumed
for each factor. See |
na.action |
a function which indicates
what should happen when the data contain NAs.
See |
... |
any of the options in |
This functions offers a user friendly formular-data interface for fitting survival models using glmnet
. Any additional glmnet
arguments can be specified in ...
.
A list of glmnetsurv
objects:
fit |
fitted |
X |
model matrix of model terms. |
y |
Surv object defining the event times and event status. |
s |
lambda used |
glmnetsurvcv
, Surv
, glmnet
, cv.glmnet
# data(veteran, package="survival") ## Fit unpenalized Cox using glmnet lam <- 0 # Should fit unpenalized Cox model gfit1 <- glmnetsurv(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior , data = veteran , lambda = lam , alpha = 1 ) print(gfit1) # Perform cross-validation gfit2 <- glmnetsurv(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior , data = veteran , lambda = NULL , alpha = 1 , s = 0.002 ) plot(gfit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.