Learn R Programming

spikeSlabGAM (version 1.1-19)

plotTerm: Plot the estimated effect of a model term.

Description

Plots the estimated linear predictor for a model term, i.e a main effect or a (2- or 3-way) interaction. Plots for the joint effect of two numerical covariates show an overlay if quantiles were specified: Regions where the pointwise credible intervals do not contain zero are plotted in muted red (\(>0\)) and blue (\(< 0\)), overlaid by coloured contour lines that show the aggregate values. Contour lines are shown only inside the convex hull of the original observations. Plots for srf:lin terms show the spatially varying coefficient, i.e. the contour lines represent the change in the linear predictor when the lin-covariate increases by 1 standard deviation. For this reason, a cumulative plot makes no sense and the routine will set cumulative = FALSE with a warning.

Usage

plotTerm(
  label,
  m,
  cumulative = TRUE,
  aggregate = mean,
  quantiles = c(0.1, 0.9),
  gridlength = 40,
  contours = 30,
  ggElems = list()
)

Arguments

label

(character) the label of the effect to be plotted.

m

a fitted spikeSlabGAM model

cumulative

Defaults to TRUE, in which case the lower order terms that are associated with the covariates involved in label are cumulated and then plotted. (e.g, if label denotes a smoooth term, the sum of the linear and smooth effect is displayed if TRUE, if label is a factor-factor interaction, the sum of both main effects and their interaction is displayed etc.) If FALSE, only the marginal effect of label is displayed.

aggregate

(function) which summary statistic to use for the posterior of the effect. Defaults to the mean.

quantiles

which quantiles to use for the borders of credible regions. Defaults to 10 regions. Cannot deal with more than two quantiles.

gridlength

length of the (univariate) grids on which to evaluate the posterior.

contours

use how many contour lines for the joint effect of two numerical covariates. Defaults to 30.

ggElems

a list of plot elements to give to ggplot. Use this to supply custom themes, colour schemes etc. Defaults to an empty list, which yields the standard settings.

Value

an object of class ggplot. Use print or wrap the call to plotTerm in parentheses to directly render on a graphic device.

Details

Limitations: Plots for 4-way (or higher) interactions are not implemented. Requesting such a plot will return the NULL object with a warning. Plots for mrf just treat the grouping variable as a conventional factor i.e. will not incorporate any neighborhood or map information.

Examples

Run this code
# NOT RUN {
#see help for spikeSlabGAM
# }

Run the code above in your browser using DataLab