| Title: | Model-Agnostic Survival Analysis |
|---|---|
| Description: | Model-agnostic survival analysis: using any Machine learning algorithm for doing survival analysis. |
| Authors: | T. Moudiki [aut, cre] |
| Maintainer: | T. Moudiki <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-05 06:31:57 UTC |
| Source: | https://github.com/Techtonique/survivalisttoo |
Model-agnostic survival analysis: using any Machine learning algorithm for doing survival analysis.
Index of help topics:
cox_gradient_boost Cox Gradient Boosting Model
predict.CoxGradientBoost
Predict from a CoxGradientBoost model
print.CoxGradientBoost
Print a CoxGradientBoost Object
survivalisttoo-package
Model-Agnostic Survival Analysis
T. Moudiki <[email protected]>
T. Moudiki [aut, cre]
Fit a model-agnostic Cox-gradient boosting survival model
cox_gradient_boost( X, time, event, regr_fun, M = 100L, nu = 0.1, show_progress = TRUE, ... )cox_gradient_boost( X, time, event, regr_fun, M = 100L, nu = 0.1, show_progress = TRUE, ... )
X |
numeric matrix of covariates (n x p) |
time |
numeric vector of observed times |
event |
integer/logical vector (1 = event, 0 = censored) |
regr_fun |
function(X, y, ...) -> model with predict() method |
M |
number of boosting iterations (default 100) |
nu |
learning rate / shrinkage (default 0.1) |
show_progress |
logical; print a progress bar? (default TRUE) |
... |
extra arguments forwarded to regr_fun at every iteration |
object of class "CoxGradientBoost"
require(glmnet) require(survival) data(ovarian) set.seed(42) idx_train <- sample(nrow(ovarian), floor(0.75 * nrow(ovarian))) df <- ovarian train <- df[idx_train, ]; test <- df[-idx_train, ] regr_lm <- function(X, y, ...) lm(y ~ ., data = data.frame(X, y = y)) fit_boost_lm <- survivalisttoo::cox_gradient_boost(train, train$futime, train$fustat, regr_lm) y_test <- Surv(test$futime, test$fustat) (ci_blm <- glmnet::Cindex(predict(fit_boost_lm, test), y_test)) # C-indexrequire(glmnet) require(survival) data(ovarian) set.seed(42) idx_train <- sample(nrow(ovarian), floor(0.75 * nrow(ovarian))) df <- ovarian train <- df[idx_train, ]; test <- df[-idx_train, ] regr_lm <- function(X, y, ...) lm(y ~ ., data = data.frame(X, y = y)) fit_boost_lm <- survivalisttoo::cox_gradient_boost(train, train$futime, train$fustat, regr_lm) y_test <- Surv(test$futime, test$fustat) (ci_blm <- glmnet::Cindex(predict(fit_boost_lm, test), y_test)) # C-index
Predict from a CoxGradientBoost model
## S3 method for class 'CoxGradientBoost' predict(object, newdata, type = "lp", times = NULL, M = NULL, ...)## S3 method for class 'CoxGradientBoost' predict(object, newdata, type = "lp", times = NULL, M = NULL, ...)
object |
a CoxGradientBoost object |
newdata |
numeric matrix or data.frame of new covariates |
type |
"lp" (default), "survival", or "cumhaz" |
times |
time grid for type != "lp"; NULL -> training event times |
M |
use only the first M base learners (early stopping probe); NULL -> all M (default) |
... |
unused |
type = "lp" -> numeric vector (length n_new) type = "survival" -> matrix (n_new x length(times)) type = "cumhaz" -> matrix (n_new x length(times))
Displays a concise summary of a fitted CoxGradientBoost model,
including the base learner, number of boosting iterations, learning rate,
and basic information about the training data.
## S3 method for class 'CoxGradientBoost' print(x, ...)## S3 method for class 'CoxGradientBoost' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods (currently unused). |
This method prints key characteristics of the fitted model:
The base learner used in boosting
The number of boosting iterations ()
The learning rate ()
The number of observations
The number of observed events
The number of unique event times
The input object x, invisibly.
cox_gradient_boost, predict.CoxGradientBoost