
gam
or
bam
model based on predictions.
In contrast with the default plot.gam
, this function
plots the summed effects and optionally removes the random effects.plot_smooth(x, view = NULL, cond = list(), rm.ranef = NULL, n.grid = 30,
rug = TRUE, col = "black", add = FALSE, se = 1.96, shade = TRUE,
eegAxis = FALSE, print.summary = TRUE, main = NULL, xlab = NULL,
ylab = NULL, ylim = NULL, h0 = 0, v0 = NULL, ...)
par
plot.gam
, plot_diff
Other functions for interpreting nonlinear effects: fvisgam
,
vis.gam2
; plotDiff2D
,
plot_diff2
; plotDiff
,
plot_diff
; plot_parametric
;
pvis.gam
, pvisgam
data(simdat)
# Model with random effect and interactions:
m1 <- bam(Y ~ te(Time, Trial)+s(Time, Subject, bs='fs', m=1),
data=simdat)
# Default plot produces only surface of Time x Trial:
plot(m1, select=1)
# Only the Time component:
plot_smooth(m1, view="Time")
# Note the summary that is printed.
# without random effects:
plot_smooth(m1, view="Time", rm.ranef=TRUE)
# Plot summed effects:
dev.new(width=8, height=4) # use x11(,8,4) on Linux
par(mfrow=c(1,2))
fvisgam(m1, view=c("Time", "Trial"),
plot.type='contour', color='topo', main='interaction',
rm.ranef=TRUE)
arrows(x0=0, x1=2200, y0=-5, y1=-5, col='red',
code=2, length=.1, lwd=2, xpd=TRUE)
plot_smooth(m1, view='Time', cond=list(Trial=-5),
main='Trial=-5', rm.ranef=TRUE)
# see the vignette for examples:
vignette("plotfunctions", package="itsadug")
Run the code above in your browser using DataLab