This article covers core features of the aorsf
package.
The oblique random survival forest (ORSF) is an extension of the axis-based RSF algorithm.
The purpose of aorsf
(‘a’ is short for accelerated) is
to provide routines to fit ORSFs that will scale adequately to large
data sets. The fastest algorithm available in the package is the
accelerated ORSF model, which is the default method used by
orsf()
:
library(aorsf)
set.seed(329)
orsf_fit <- orsf(data = pbc_orsf,
n_tree = 5,
formula = Surv(time, status) ~ . - id)
orsf_fit
#> ---------- Oblique random survival forest
#>
#> Linear combinations: Accelerated Cox regression
#> N observations: 276
#> N events: 111
#> N trees: 5
#> N predictors total: 17
#> N predictors per node: 5
#> Average leaves per tree: 20
#> Min observations in leaf: 5
#> Min events in leaf: 1
#> OOB stat value: 0.80
#> OOB stat type: Harrell's C-statistic
#> Variable importance: anova
#>
#> -----------------------------------------
you may notice that the first input of aorsf
is
data
. This is a design choice that makes it easier to use
orsf
with pipes (i.e., %>%
or
|>
). For instance,
aorsf
includes several functions dedicated to
interpretation of ORSFs, both through estimation of partial dependence
and variable importance.
aorsf
provides multiple ways to compute variable
importance.
To compute negation importance, ORSF multiplies each coefficient of that variable by -1 and then re-computes the out-of-sample (sometimes referred to as out-of-bag) accuracy of the ORSF model.
orsf_vi_negate(orsf_fit)
#> bili copper albumin age hepato protime
#> 0.122002394 0.096358017 0.036400482 0.028834332 0.026420760 0.023000353
#> sex chol ascites edema platelet spiders
#> 0.022483102 0.022418909 0.018742854 0.009798854 0.008071339 0.005930916
#> trig stage ast trt alk.phos
#> 0.003518788 0.002754882 0.001167876 -0.001060327 -0.003055007
You can also compute variable importance using permutation, a more classical approach.
orsf_vi_permute(orsf_fit)
#> copper bili ascites albumin age
#> 0.0608701256 0.0451519919 0.0291483213 0.0142535184 0.0128600320
#> stage protime trt edema trig
#> 0.0094346640 0.0082164587 0.0067024759 0.0065563853 0.0062649355
#> chol spiders ast sex platelet
#> 0.0060757549 0.0053818120 0.0028757013 0.0028113033 0.0015161714
#> alk.phos hepato
#> -0.0005739611 -0.0023184389
A faster alternative to permutation and negation importance is ANOVA importance, which computes the proportion of times each variable obtains a low p-value (p < 0.01) while the forest is grown.
orsf_vi_anova(orsf_fit)
#> ascites copper bili edema age stage hepato
#> 0.70000000 0.36363636 0.33333333 0.33074768 0.23809524 0.22222222 0.16666667
#> alk.phos spiders chol sex platelet trig ast
#> 0.15789474 0.15384615 0.14285714 0.11764706 0.11538462 0.10526316 0.08000000
#> protime trt
#> 0.06666667 0.04761905
Partial dependence (PD) shows the expected prediction from a model as a function of a single predictor or multiple predictors. The expectation is marginalized over the values of all other predictors, giving something like a multivariable adjusted estimate of the model’s prediction.
For more on PD, see the vignette
Unlike partial dependence, which shows the expected prediction as a function of one or multiple predictors, individual conditional expectations (ICE) show the prediction for an individual observation as a function of a predictor.
For more on ICE, see the vignette
The original ORSF (i.e., obliqueRSF
) used
glmnet
to find linear combinations of inputs.
aorsf
allows users to implement this approach using the
orsf_control_net()
function:
orsf_net <- orsf(data = pbc_orsf,
formula = Surv(time, status) ~ . - id,
control = orsf_control_net())
net
forests fit a lot faster than the original ORSF
function in obliqueRSF
. However, net
forests
are still much slower than cph
ones.
The unique feature of aorsf
is its fast algorithms to
fit ORSF ensembles. RLT
and obliqueRSF
both
fit oblique random survival forests, but aorsf
does so
faster. ranger
and randomForestSRC
fit
survival forests, but neither package supports oblique splitting.
obliqueRF
fits oblique random forests for classification
and regression, but not survival. PPforest
fits oblique
random forests for classification but not survival.
Note: The default prediction behavior for aorsf
models
is to produce predicted risk at a specific prediction horizon, which is
not the default for ranger
or randomForestSRC
.
I think this will change in the future, as computing time independent
predictions with aorsf
could be helpful.