| predict.rfmstate | R Documentation |
Predicts clock-reset semi-Markov state-occupation probabilities conditional on fresh entry into a selected state at elapsed duration zero.
## S3 method for class 'rfmstate'
predict(
object,
newdata = NULL,
times = NULL,
s = 0,
start_state = NULL,
grid_step = NULL,
target_grid_points = 1024L,
max_grid_points = 131073L,
grid_tol = 5e-04,
max_grid_refinements = 7L,
check_grid = TRUE,
extrapolate = c("error", "flat"),
...
)
object |
A fitted |
newdata |
Prediction profiles. |
times |
Finite nonnegative elapsed durations. |
s |
Legacy start-time argument; only zero is supported. |
start_state |
Fresh-entry starting state. Defaults to the common initial state. |
grid_step |
Optional positive initial internal grid step. |
target_grid_points |
Initial regular-grid interval count when
|
max_grid_points |
Maximum allowed internal grid-point count. |
grid_tol |
Maximum change permitted between successive refinements. |
max_grid_refinements |
Maximum number of grid-step halvings. |
check_grid |
Whether convergence is required. Keep |
extrapolate |
|
... |
Ignored; no ranger arguments are accepted during prediction. |
These are not general Markov P(s,t) matrices. Predictions do
not condition on an already elapsed sojourn and carry no confidence bands.
By default the horizon cannot exceed the minimum observed sojourn support
among reachable transient states.
An rfmstate_pred object. entry_prob and the temporary
alias P have dimensions profile by selected starting state by
occupied state by elapsed time; the starting-state dimension has length
one. state_occ is that selected starting-state slice.
The object also contains requested time, per-profile edge
cum_hazard, validated newdata, used columns, support and
extrapolation metadata, grid-convergence records, conditioning statement,
predictor-support extrapolation records, fit-specific schema identifier,
state structure, and package versions.
Prediction is conditional on fresh entry into start_state at elapsed
duration zero. General P(s,t) prediction for s > 0, left
truncation, ongoing-sojourn/landmark prediction, recurrent histories, and
confidence intervals are unavailable. Missing covariates, nonfinite numeric
values, incompatible classes, and unseen factor levels are rejected.
Numeric values outside the fit-specific range warn and are recorded as
predictor-support extrapolation; they are never truncated.
Times beyond support fail unless extrapolate = "flat"; that option
assumes zero additional hazard and is a sensitivity analysis only.
ms <- clinical_states()
dat <- sim_clinical_data(300, structure = ms, seed = 42)
long <- prepare_data(
dat, "ID", ms,
list(Responded="time_Responded", Unresponded="time_Unresponded",
Stabilized="time_Stabilized", Progressed="time_Progressed",
Death="time_Death"),
"time_censored", c("age", "sex", "BMI", "treatment")
)
fit <- rfmstate(long, num.trees = 100, min_events = 3, seed = 42)
horizon <- min(fit$max_duration_by_origin)
predict(fit, data.frame(age=60, sex=1, BMI=26, treatment=1),
times = c(0, horizon / 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.