rsf_pro: Train a Random Survival Forest Model

View source: R/prognosis.R

rsf_proR Documentation

Train a Random Survival Forest Model

Description

Trains a Random Survival Forest (RSF) model using randomForestSRC.

Usage

rsf_pro(X, y_surv, tune = FALSE)

Arguments

X

A data frame of features.

y_surv

A survival::Surv object representing the survival outcome.

tune

Logical, whether to perform hyperparameter tuning (a simplified message is currently provided, full tuning with tune.rfsrc is recommended for advanced use).

Value

A list of class "train" containing the trained rfsrc model object, names of features used in training, and model type. The returned object also includes fitted_scores and y_surv.

Examples


# Generate some dummy survival data
set.seed(42)
n_samples <- 50
n_features <- 5
X_data <- as.data.frame(matrix(rnorm(n_samples * n_features), ncol = n_features))
Y_surv_obj <- survival::Surv(
  time = runif(n_samples, 100, 1000),
  event = sample(0:1, n_samples, replace = TRUE)
)

# Train the model (ntree is small for a quick example)
rsf_model <- rsf_pro(X_data, Y_surv_obj)
print(rsf_model$finalModel)


E2E documentation built on Aug. 27, 2025, 1:09 a.m.