| internal.utils | R Documentation |
These helper functions support advanced random-hazard-forest workflows, including data conversion, simulation, and predictor weighting.
convert.counting(f, dta, scale = FALSE)
convert.standard.counting(formula, data,
scale = FALSE,
rescale.from.attr = FALSE,
keep.id = FALSE,
keep.row_index = FALSE,
sorted = FALSE,
id.default = "id",
eps = 1e-8,
landmark.time = NULL,
landmark.use.tminus = TRUE,
return.type = c("survival", "x"),
keep.landmark.cols = FALSE)
hazard.simulation(type = 1,
n = 500, p = 10, nrecords = 7,
scale = FALSE, ngrid = 1e5, ...)
xvar.wt.rhf(f, d, scale = 4, parallel = TRUE)
f, formula |
A survival formula. |
dta, data, d |
Input data frame. |
scale |
Logical or numeric time-scaling control, depending on the helper being used. |
rescale.from.attr |
Logical; if |
keep.id |
Logical; if |
keep.row_index |
Logical; if |
sorted |
Logical; indicates whether the counting-process input is already sorted by subject and time. |
id.default |
Default subject identifier column name used when
|
eps |
Small positive tolerance used in internal time comparisons. |
landmark.time |
Optional landmark time passed to
|
landmark.use.tminus |
Logical; controls how landmark covariates are
selected when |
return.type |
Character string specifying whether
|
keep.landmark.cols |
Logical; if |
type |
Simulation scenario. May be given numerically
( |
n, p, nrecords, ngrid |
Simulation controls used by
|
... |
Additional arguments passed to the selected simulation engine. |
parallel |
Logical; if |
convert.counting() converts standard right-censored survival data to the
counting-process representation expected by rhf().
convert.standard.counting() converts counting-process style RHF data to
a conventional survival-analysis data frame or to a predictor-only frame.
hazard.simulation() generates synthetic counting-process data together
with the corresponding theoretical hazard function.
xvar.wt.rhf() computes variable weights that can be supplied to
rhf(..., xvar.wt = ...).
The returned value depends on the helper:
convert.counting(): a data frame with columns
id, start, stop, event, followed by the predictor
columns from the input data.
convert.standard.counting(): a data frame in the format requested
by return.type. With return.type = "survival", the leading
columns are time and event; additional covariate and optional
helper columns may also be present. The function may return an empty data
frame when no valid rows remain after filtering.
hazard.simulation(): a list with components dta
(simulated counting-process data frame), haz
(a function that evaluates the true hazard on a supplied time grid), and
scale (the time-scaling factor used in the simulation).
xvar.wt.rhf(): a named numeric vector of predictor weights for
the xvar.wt argument of rhf().
rhf,
predict.rhf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.