fracplot {mfp2} | R Documentation |
Plot response functions from a fitted mfp2
object
Description
Plots the partial linear predictors with confidence limits against the selected covariate(s) of interest.
Usage
fracplot(
model,
terms = NULL,
partial_only = FALSE,
type = c("terms", "contrasts"),
ref = NULL,
terms_seq = c("data", "equidistant"),
alpha = 0.05,
color_points = "#AAAAAA",
color_line = "#000000",
color_fill = "#000000",
shape = 1,
size_points = 1,
linetype = "solid",
linewidth = 1,
alpha_fill = 0.1
)
plot_mfp(...)
Arguments
model |
fitted |
terms |
character vector with variable names to be plotted. |
partial_only |
a logical value indicating whether only the partial
predictor (component) is drawn ( |
type , ref , terms_seq |
arguments of |
alpha |
|
color_line , linetype , linewidth |
|
color_fill , alpha_fill |
|
shape , size_points , color_points |
|
... |
used in alias |
Details
The confidence limits of the partial linear predictors or contrasts are obtained from the variance–covariance matrix of the final fitted model, which takes into account the uncertainty in estimating the model parameters but not the FP powers. This can lead to narrow confidence intervals. A simple way to obtain more realistic confidence intervals within the FP is by using bootstrap, which is not currently implemented. See Royston and Sauerbrei (2008) chapter 4.9.2 for guidance on conducting bootstrapping within the FP class.
The component-plus-residual, is the partial linear predictor plus residuals,
where deviance residuals are used in generalized linear regression models,
while martingale residuals are used in Cox models, as done in Stata mfp program.
This kind of plot is only available if type = "terms"
.
Value
A list of ggplot2
plot objects, one for each term requested. Can be
drawn as individual plots or facetted / combined easily using e.g.
patchwork::wrap_plots
and further customized.
Functions
-
plot_mfp()
: Alias for fracplot.
See Also
Examples
# Gaussian
data("prostate")
x = as.matrix(prostate[,2:8])
y = as.numeric(prostate$lpsa)
# default interface
fit = mfp2(x, y, verbose = FALSE)
fracplot(fit) # generate plots