| fracplot | R Documentation |
fracplot() is retained temporarily for compatibility with code written
for earlier versions of mfp2. Use plot.mfp2() or plot() instead.
fracplot(
model,
terms = NULL,
partial_only = FALSE,
type = c("terms", "contrasts"),
ref = NULL,
terms_seq = c("data", "equidistant"),
alpha = 0.05,
show_titles = TRUE,
show_grid = FALSE,
color_points = "#AAAAAA",
color_line = "red",
color_line_spike = "red",
color_fill = "#000000",
shape = 16,
size_points = 1,
size_points_spike = 2,
linetype = "solid",
linewidth = 1,
alpha_fill = 0.1
)
model |
A fitted object of class |
terms |
Names of the variables to plot, for example,
|
partial_only |
Whether to show only the fitted effect and confidence
interval. Defaults to |
type |
Either |
ref |
Named list of reference values for contrast plots, for example,
|
terms_seq |
Either |
alpha |
Significance level for confidence intervals. The default,
|
show_titles |
Whether to show titles describing the fitted
transformation or variable representation. Defaults to |
show_grid |
Whether to show the major and minor panel grid lines of
|
color_points |
Colour of component-plus-residual points, for example,
|
color_line |
Colour of fitted curves and fitted points for binary
predictors and factors, for example, |
color_line_spike |
Colour of the separate zero endpoint for a
|
color_fill |
Fill colour of confidence bands, for example,
|
shape |
Shape of component-plus-residual points. Common ggplot2
shape codes include |
size_points |
Numeric size of component-plus-residual points,
in millimetres, for example, |
size_points_spike |
Numeric size of fitted points for binary
predictors, factors, and zero endpoints.
For example, use |
linetype |
Line style of fitted curves, for example, |
linewidth |
Numeric width of fitted curves, for example, |
alpha_fill |
Confidence-band transparency, from |
The function forwards its arguments to plot.mfp2() and returns the same
plot objects, except that its own defaults for color_line and
color_line_spike are "red", whereas plot.mfp2() uses "black".
The sections referred to in the argument
descriptions, such as Choosing terms, are on the help page of
plot.mfp2().
A named list of ggplot2 objects, one for each plotted term, identical to
the result returned by plot.mfp2() called with the same arguments
(including the colours).
plot.mfp2()
data("prostate")
fit <- mfp2(
lpsa ~ fp(age) + fp(cavol) + fp(weight) + svi,
data = prostate,
verbose = FALSE
)
# Plotting requires ggplot2.
if (requireNamespace("ggplot2", quietly = TRUE)) {
# Recommended interface
plots <- plot(fit, terms = "cavol")
print(plots)
}
if (requireNamespace("ggplot2", quietly = TRUE)) {
# Deprecated compatibility interface
old_plots <- fracplot(fit, terms = "cavol")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.