ggrmsMD | R Documentation |
rms
modelThe ggrmsMD
function processes the output from models fitted using the rms
package and produces one or more ggplot2
objects visualising restricted cubic splines (RCS).
The function detects RCS terms in the model and plots them all, with a suitable y-axis selected based on the model type. This outputs a list of plots, or a multi-panel figure using the combined
argument.
As outputs are ggplot
objects they can easily be further customised by the user.
ggrmsMD(
modelfit,
data,
noeffline = TRUE,
shade_inferior = "none",
combined = TRUE,
ylab = NULL,
xlabs = NULL,
titles = NULL,
ylim = NULL,
log_y = FALSE,
log_y_breaks = NULL,
xlims = NULL,
log_x_vars = NULL,
log_x_breaks = NULL,
lrm_prob = FALSE,
var = NULL,
np = 400,
...
)
modelfit |
A model object from |
data |
The dataset used to fit the model. |
noeffline |
Logical. If |
shade_inferior |
Character. Options are |
combined |
Logical. If |
ylab |
Optional character. Override the default y-axis label. |
xlabs |
A named list of x-axis labels for each variable. E.g., |
titles |
A named list of plot titles for each variable. |
ylim |
Numeric vector (length 2). y-axis limits applied to all plots. E.g., |
log_y |
Logical. If |
log_y_breaks |
Optional numeric vector specifying y-axis tick marks when |
xlims |
A named list of x-axis limits per variable. E.g., |
log_x_vars |
Character vector. Names of variables for which x-axis should be log10-transformed. |
log_x_breaks |
A named list specifying x-axis tick marks for variables with log10-transformed x-axis. |
lrm_prob |
Logical. If |
var |
Character vector. Optional. Variables to plot. If |
np |
Integer. Number of points used to predict spline curves. Default is |
... |
Additional arguments passed to |
A ggplot
object (if one variable is plotted), a list of ggplot
objects (if multiple variables), or a single combined cowplot
plot if combined = TRUE
.
# For details examples and plots please see the provided vignettes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.