deepAFT | R Documentation |
Fit a deep learning survival regression model. These are location-scale models for an arbitrary transform of the time variable; the most common cases use a log transformation, leading to accelerated failure time models.
deepAFT(x, ...)
## S3 method for class 'formula'
deepAFT(formula, model, data, control = list(...),
method = c("BuckleyJames", "ipcw", "transform"), ...)
## Default S3 method:
deepAFT(x, y, model, control, ...)
## S3 method for class 'ipcw'
deepAFT(x, y, model, control, ...)
# use:
# deepAFT.ipcw(x, y, model, control)
# or
# class(x) = "ipcw"
# deepAFT(x, y, model, control)
#
## S3 method for class 'trans'
deepAFT(x, y, model, control, ...)
# use:
# class(x) = "transform"
# deepAFT(x, y, model, control)
formula |
a formula expression as for other regression models. The response is usually a survival object as returned by the 'Surv' function. See the documentation fo'Surv', 'lm' and 'formula' for details. |
model |
Keras model, see below for details. |
data |
a data.frame in which to interpret the variables named in the formula. |
x |
Covariates for AFT model |
y |
Surv object for AFT model |
method |
methods to handl censoring data in deep AFT model fit, 'BuckleyJames' for Buckley and James method, 'ipcw' for inverse probability censoring weights method. 'transform' for transformation based on book of Fan and Gijbels (1996, page 168) |
control |
a list of control values, in the format produced by 'deepAFTcontrol'. The default value 'deepAFTcontrol()' |
... |
optional arguments |
See "Deep learning with R" for details on how to build a deep learning model.
The following parameters in 'deepAFTcontrol' will be used to control the model fit process.
'epochs': number of deep learning epochs, default is 30.
'batch.n': batch size, default is 128. 'NaN' may be generated if batch size is too small and there is not event in a batch.
'v_split': validation split, a numerical value in [0, 1), for portion of samples used for validation, default is 0.
'verbose': vervose = 1 for print out verbose during the model fit, 0 for not print.
'epsilon': espilon for converence check, default is epsilon = 0.001.
'max.iter': number of maximum iteration, default is max.iter = 30.
'censor.groups': a vector for censoring groups. A KM curve for censoring will be fit for each group. If a matrix is privided, the a Cox model will be used to predict the censoring probability.
When the variance for covariance matrix X is too large, please use xbar = apply(x, 2, stndx) to standardize X.
An object of class "deepAFT" is returned. The deepAFT object contains the following list components:
x |
Covariates for AFT model |
y |
Surv object for AFT model |
model |
Keras model |
mean.ipt |
mean survival or censoring time |
predictor |
predictor score mu = f(x) |
risk |
risk score = exp(predictor) |
method |
method for deepAFT fitting, either Buckley-James or IPCW |
For right censored survival time only
Chen, B. E. and Norman P.
Buckley, J. and James, I. (1979). Linear regression with cencored data. Biometrika, 66, page 429-436.
Norman, P. and Chen, B. E. (2019). DeepAFAT: A nonparametric accelerated failure time model with artifical neural network. Manuscript to be submitted.
Chollet, F. and Allaire J. J. (2017). Deep learning with R. Manning.
print.deepAFT
, survreg
, ibs.deepAFT
## Example for deep learning model
##
### Keras
#model = keras_model_sequential()
### define model layers
#model %>% layer_dense(units = 7, activation = 'relu', input_shape = c(p)) %>%
# layer_dense(units = 11, activation = 'relu') %>%
# layer_dropout(rate = 0.1)%>%
# layer_dense(units = 7, activation = 'relu') %>%
# layer_dense(units = 1)
### Compile (Define loss and optimizer)
#model %>% compile(loss = 'mse',
# optimizer = optimizer_adam(lr=alpha_lr, decay=decay_rate))
#summary(model)
# fit = deepAFT(Surv(time, status) ~ x)
# print(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.