Wraps grf::causal_survival_forest() with a column-name interface and
computes out-of-bag effect predictions through predict().
Usage
fit_survival_forest(
data,
time,
status,
treatment,
covariates,
target = "RMST",
horizon = NULL,
num.trees = 2000,
seed = 1,
...
)Arguments
- data
A data frame containing all required columns.
- time
Name of observed time column.
- status
Name of event indicator column (1 = event, 0 = censored).
- treatment
Name of treatment column.
- covariates
Character vector of baseline covariate column names.
- target
Prediction target passed to
grf::predict().- horizon
Optional horizon passed to
grf::predict().- num.trees
Number of trees passed to
grf::causal_survival_forest().- seed
Random seed passed to
grf::causal_survival_forest().- ...
Additional arguments passed to
grf::causal_survival_forest().
Examples
if (FALSE) { # \dontrun{
set.seed(2)
n <- 300
df <- data.frame(
time = rexp(n, 0.2),
status = rbinom(n, 1, 0.8),
trt = rbinom(n, 1, 0.5),
x1 = rnorm(n),
x2 = rnorm(n)
)
fit <- fit_survival_forest(
data = df,
time = "time",
status = "status",
treatment = "trt",
covariates = c("x1", "x2"),
target = "RMST",
horizon = 5
)
head(as.data.frame(fit))
} # }