This function plots the estimated linear predictors of the terms in a model on
a grid of values. By default displays all 3-way, 2-way interactions and main
effects present in the model. Starting with ggplot-0.9.2 these are no longer
aligned by their axes due to internal changes in grid and ggplot2. Uses
gridExtra's marrangeGrob
to arrange the plots
for the terms, also over multiple pages if necessary. This means the graphics
device type is temporarily set to the value of interactive.dev
in
interactive use in RStudio if necessary since the RStudioGD
graphical
device does not support opening multiple pages.
# S3 method for spikeSlabGAM
plot(
x,
labels = NULL,
cumulative = TRUE,
commonEtaScale = FALSE,
aggregate = mean,
quantiles = c(0.1, 0.9),
gridlength = 20,
base_size = 12,
ggElems = list(),
nrow = min(ceiling(sqrt(length(plotList))), 3),
ncol = min(ceiling(length(plotList)/nrow), 3),
interactive.dev = c("x11", "quartz", "windows"),
...
)
a fitted spikeSlabGAM
model
a character vector of names of model terms to be plotted
Defaults to TRUE, in which case all lower order terms that are involved in an interaction are cumulated and then plotted (e.g, if a model contains 2 smooth effects and their interaction, ONLY the sum of the marginal smooth and linear terms and all their interactions are plotted.) If FALSE, a separate plot for every term in the model is produced.
use the same limits for all vertical axes of the different panels? Defaults to FALSE. Can be useful to compare effect sizes more easily between panels, but tends to mess up the scales.
(function) which summary statistic to use for the posterior of the model terms. Defaults to the mean.
which quantiles to use for the borders of credible regions. Defaults to 10% and 90% percentiles. Set to NULL to omit plotting credible regions.
length of the (univariate) grids for the covariates on which to evaluate the posterior. Defaults to 20.
default base font size for plot (see e.g.
theme_gray
)
a list of plot elements to give to ggplot
. Use this to
supply custom themes or colors, fortify the plot(s) with partial residuals
etc. Defaults to an empty list. Unless specified differently here, the
default ggplot-theme (theme_gray
) is changed to a
white background with major gridlines in gray ('grey95'
), no minor
grid lines, and smaller text for the legends.
number of rows per page, defaults to min(sqrt(no. of plots), 3).
See marrangeGrob
.
number of columns per page, defaults to min((no. of plots)/nrow,
3). See marrangeGrob
.
alternative device to use in interactive mode in RStudio if output needs to be spread on multiple pages, since the RStudio graphical device does not support opening multiple displays.
arguments passed to marrangeGrob
.
a list of ggplot
-objects (invisible)
plotTerm
for more details on the specific plots
# NOT RUN {
#see ?spikeSlabGAM
# }
Run the code above in your browser using DataLab