Learn R Programming

itsadug (version 1.0.1)

plot_diff2: Plot difference surface based on model predictions.

Description

Plot difference surface based on model predictions.

Usage

plot_diff2(model, view, comp, cond = NULL, color = "topo", nCol = 100,
  col = NULL, add.color.legend = TRUE, plotCI = FALSE, f = 1.96,
  n.grid = 30, nlevels = 10, zlim = NULL, xlim = NULL, ylim = NULL,
  main = NULL, xlab = NULL, ylab = NULL, rm.ranef = NULL,
  hide.label = FALSE, print.summary = getOption("itsadug_print"), ...)

Arguments

model
A GAMM model, resulting from the functions gam or bam.
view
Name of continuous predictors that should be plotted on the x- and y-axes. Vector of two values.
comp
Named list with the grouping predictor (categorical variable) and the 2 levels to calculate the difference for.
cond
Named list of the values to use for the other predictor terms (not in view).
color
Colorpalette
nCol
Range of colors of background of contour plot.
col
Line color.
add.color.legend
Logical: whether or not to add a color legend. Default is TRUE. If FALSE (omitted), one could use the function gradientLegend to add a legend manually at any position.
plotCI
Logical: whether or not to plot confidence intervals.
f
A number to scale the standard error. Defaults to 1.96, resulting in 95% confidence intervals. For 99% confidence intervals use a value of 2.58.
n.grid
Resolution.
nlevels
Levels of contour lines.
zlim
A two item array giving the lower and upper limits for the z- axis scale. NULL to choose automatically.
xlim
A two item array giving the lower and upper limits for the x- axis scale. NULL to choose automatically.
ylim
A two item array giving the lower and upper limits for the y- axis scale. NULL to choose automatically.
main
Title of plot.
xlab
Label x-axis.
ylab
Label y-axis.
rm.ranef
Logical: whether or not to remove random effects. Default is FALSE. Alternatively a string (or vector of strings) with the name of the random effect(s) to remove.
hide.label
Logical: whether or not to hide the label (i.e., "difference"). Default is FALSE.
print.summary
Logical: whether or not to print a summary. Default set to the print info messages option (see infoMessages).
...
Optional arguments for plotsurface.

Value

  • If the result is not being plotted, a list is returned with the estimated difference (est) and the standard error over the estimate (se.est) and the x-values (x) is returned.

See Also

Other functions for interpreting nonlinear effects: fvisgam, vis.gam2; plotDiff, plot_diff; plot_parametric; plot_smooth; plot_topo; pvis.gam, pvisgam

Examples

Run this code
data(simdat)
m1 <- bam(Y ~ Group + te(Time, Trial, by=Group),
    data=simdat)
plot_diff2(m1, view=c('Time', 'Trial'),
    comp=list(Group=c("Children", "Adults")))
# see the vignette for examples:
vignette("plotfunctions", package="itsadug")

Run the code above in your browser using DataLab