spark.survreg {SparkR} | R Documentation |
spark.survreg
fits an accelerated failure time (AFT) survival regression model on
a SparkDataFrame. Users can call summary
to get a summary of the fitted AFT model,
predict
to make predictions on new data, and write.ml
/read.ml
to
save/load fitted models.
spark.survreg(data, formula, ...) ## S4 method for signature 'AFTSurvivalRegressionModel,character' write.ml(object, path, overwrite = FALSE) ## S4 method for signature 'SparkDataFrame,formula' spark.survreg(data, formula, ...) ## S4 method for signature 'AFTSurvivalRegressionModel' summary(object, ...) ## S4 method for signature 'AFTSurvivalRegressionModel' predict(object, newData)
data |
A SparkDataFrame for training |
formula |
A symbolic description of the model to be fitted. Currently only a few formula operators are supported, including '~', ':', '+', and '-'. Note that operator '.' is not supported currently |
object |
A fitted AFT survival regression model |
path |
The directory where the model is saved |
overwrite |
Overwrites or not if the output path already exists. Default is FALSE which means throw exception if the output path exists. |
newData |
A SparkDataFrame for testing |
spark.survreg
returns a fitted AFT survival regression model
summary
returns a list containing the model's coefficients,
intercept and log(scale)
predict
returns a SparkDataFrame containing predicted values
on the original scale of the data (mean predicted value at scale = 1.0)
write.ml(AFTSurvivalRegressionModel, character) since 2.0.0
spark.survreg since 2.0.0
summary(AFTSurvivalRegressionModel) since 2.0.0
predict(AFTSurvivalRegressionModel) since 2.0.0
survival: https://cran.r-project.org/web/packages/survival/
## Not run:
##D df <- createDataFrame(ovarian)
##D model <- spark.survreg(df, Surv(futime, fustat) ~ ecog_ps + rx)
##D
##D # get a summary of the model
##D summary(model)
##D
##D # make predictions
##D predicted <- predict(model, df)
##D showDF(predicted)
##D
##D # save and load the model
##D path <- "path/to/model"
##D write.ml(model, path)
##D savedModel <- read.ml(path)
##D summary(savedModel)
## End(Not run)