View source: R/plot.boostmtree.R
| plot.boostmtree | R Documentation |
Display fitted trajectories, error paths, and related diagnostics for objects
produced by boostmtree() or compatible prediction methods.
## S3 method for class 'boostmtree'
plot(
x,
use.rmse = TRUE,
output = c("plot", "data", "pdf"),
file = NULL,
width = 10,
height = 10,
verbose = TRUE,
...
)
x |
An object of class |
use.rmse |
Logical; if |
output |
How the result should be returned. The default,
|
file |
File path used when |
width |
Width of the PDF device in inches when
|
height |
Height of the PDF device in inches when
|
verbose |
Logical; when |
... |
Currently ignored. Included for S3 compatibility. |
The plot method is intended to give a quick visual summary of a fitted
boostmtree object.
For a grow object, the panels typically show some combination of:
fitted trajectories over time,
residual trajectories,
observed-versus-fitted summaries,
the cross-validation error path when cv.flag = TRUE, and
the iteration paths for the nuisance parameters rho,
phi, and lambda.
For a prediction object, the same plotting framework is used when stored test errors or variable-importance summaries are available.
Unlike the original implementation, the default behavior is now to draw on the
active graphics device. A PDF file is created only when
output = "pdf" is requested explicitly.
When output = "data", the method returns the numerical information used
to make the plot. This is useful if you want to inspect the fitted curves or
construct your own custom graphics.
If output = "data", a list of plot-data objects is returned, one element
per boosted subproblem. Each element can contain components such as
time.by.subject, fitted.by.subject, observed.by.subject,
error.path, rho.path, phi.path, lambda.path, and
m.opt. Otherwise the same list is returned invisibly after plotting or
writing the PDF file.
Pande A., Li L., Rajeswaran J., Ehrlinger J., Kogalur U.B., Blackstone E.H., Ishwaran H. (2017). Boosted multivariate trees for longitudinal data. Machine Learning, 106(2):277–305.
Pande A., Ishwaran H., Blackstone E.H., Rajeswaran J., and Gillanov M. (2022). Application of gradient boosting in evaluating surgical ablation for atrial fibrillation. SN Computer Science, 3:466.
Pande A., Ishwaran H., and Blackstone E.H. (2022). Boosting for multivariate longitudinal responses. SN Computer Science, 3:186.
boostmtree,
print.boostmtree,
simLong
## Fit a small model and draw the default summary plot.
set.seed(23)
sim.obj <- simLong(n = 15, n.time = 4, family = "continuous")
dta <- sim.obj$data.list
fit <- boostmtree(
x = dta$features,
tm = dta$time,
id = dta$id,
y = dta$y,
family = "continuous",
M = 8,
verbose = FALSE
)
plot(fit)
## Return the plot data instead of drawing.
plot.data <- plot(fit, output = "data")
names(plot.data[[1]])
## Write the plot to a PDF only when requested explicitly.
out.file <- tempfile(fileext = ".pdf")
plot(fit, output = "pdf", file = out.file, verbose = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.