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
)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).
A fitted object of class "mfp2".
Names of the variables to plot, for example,
c("age", "cavol"). By default (NULL), requests all variables kept in
the final model. See Choosing terms.
Whether to show only the fitted effect and confidence
interval. Defaults to FALSE. See Component-plus-residual plots.
Either "terms" (default) or "contrasts".
See Choosing the plot type.
Named list of reference values for contrast plots, for example,
list(age = 50). See Contrasts and reference values.
Either "data" or "equidistant".
See Evaluation values for their meaning and defaults.
Significance level for confidence intervals. The default,
0.05, gives 95 percent intervals. See Confidence intervals.
Whether to show titles describing the fitted
transformation or variable representation. Defaults to TRUE.
Whether to show the major and minor panel grid lines of
ggplot2::theme_bw(). Defaults to FALSE, which draws plots without
grid lines.
Colour of component-plus-residual points, for example,
"grey60" or "#AAAAAA". All colour arguments accept ggplot2 colour
names or hexadecimal codes. See ggplot2::aes_colour_fill_alpha.
Colour of fitted curves and fitted points for binary
predictors and factors, for example, "black" or "blue". Also used
for the zero endpoint of a term fitted with zero = TRUE alone.
Colour of the separate zero endpoint for a
catzero or spike-at-zero term with a continuous component,
for example, "red".
Fill colour of confidence bands, for example,
"lightblue" or "#56B4E9".
Shape of component-plus-residual points. Common ggplot2
shape codes include 1 for open circles and 16 for solid circles.
The default is 16. See ggplot2::scale_shape().
Numeric size of component-plus-residual points,
in millimetres, for example, 1 or 2. The default is 1.
See ggplot2::geom_point().
Numeric size of fitted points for binary
predictors, factors, and zero endpoints.
For example, use 3 for larger points. The default is 2.
See ggplot2::geom_point().
Line style of fitted curves, for example, "solid",
"dashed", or "dotted". The default is "solid".
See ggplot2::scale_linetype().
Numeric width of fitted curves, for example, 0.5
or 1. Larger values produce thicker lines. The default is 1.
See ggplot2::geom_line().
Confidence-band transparency, from 0 (transparent)
to 1 (opaque).
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().
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)
}
# \donttest{
if (requireNamespace("ggplot2", quietly = TRUE)) {
# Deprecated compatibility interface
old_plots <- fracplot(fit, terms = "cavol")
}
# }
Run the code above in your browser using DataLab