| plot.rfmstate_pred | R Documentation |
Visualizes predicted state occupation probabilities and transition probabilities for individual patients.
## S3 method for class 'rfmstate_pred'
plot(
x,
type = c("state_occupation", "transition_prob"),
subject = 1L,
col = NULL,
main = NULL,
states = NULL,
xlab = "Elapsed duration",
ylab = NULL,
...
)
x |
An |
type |
Character, one of |
subject |
Integer, which subject to plot (default 1). Use 0 for mean across all subjects. |
col |
One or more state colors. Values are recycled when necessary;
|
main |
Title. |
states |
Occupied states to display. |
xlab, ylab |
Axis labels. |
... |
Additional arguments passed to |
The input x object, returned invisibly. Called for its
side effect of producing a plot.
Curves are entry-conditioned on fresh entry into the fitted
start_state; they are not general Markov P(s,t) curves and have
no confidence bands. subject = 0 is an arithmetic mean of profile
predictions, not a population-standardized estimator. The historical
"transition_prob" plot type displays the occupied-state components
conditional on the selected fresh-entry state.
ms <- define_multistate(c("A", "B"), "B", list(A = "B"))
dat <- data.frame(id = 1:60, x = seq(-1, 1, length.out = 60),
time_B = 1:60, censor = NA_real_)
long <- prepare_data(dat, "id", ms, list(B = "time_B"), "censor", "x")
fit <- rfmstate(long, num.trees = 20, min.node.size = 3,
min_events = 3, sparse_warning = Inf, seed = 42)
pred <- predict(fit, data.frame(x = 0), times = c(0, 5, 10),
target_grid_points = 64, max_grid_points = 1025)
plot(pred, states = c("A", "B"), xlab = "Elapsed day")
plot(pred, type = "transition_prob", states = "B")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.