# NOT RUN {
data(simdat)
# }
# NOT RUN {
# Model with random effect and interactions:
m1 <- bam(Y ~ te(Time, Trial)+s(Time, Subject, bs='fs', m=1),
data=simdat, discrete=TRUE)
# Plot summed effects:
vis.gam(m1, view=c("Time", "Trial"), plot.type='contour', color='topo')
# Partial effect of interaction:
pvisgam(m1, view=c("Time", "Trial"), select=1)
# Same:
plot(m1, select=1, scheme=2)
plot(m1, select=1)
# Alternatives:
pvisgam(m1, view=c("Trial", "Time"), select=1)
pvisgam(m1, view=c("Trial", "Time"), select=1, zlim=c(-20,20))
pvisgam(m1, view=c("Trial", "Time"), select=1, zlim=c(-20,20),
color="terrain")
pvisgam(m1, view=c("Trial", "Time"), select=1, zlim=c(-20,20),
color=c("blue", "white", "red"))
# Notes on the color legend:
# Labels can easily fall off the plot, therefore the numbers are
# automatically rounded.
# To undo the rounding, set dec=NULL:
pvisgam(m1, view=c("Time", "Trial"), dec=NULL)
# For custom rounding, set dec to a value:
pvisgam(m1, view=c("Time", "Trial"), dec=3)
# To increase the left marging of the plot (so that the numbers fit):
oldmar <- par()$mar
par(mar=oldmar + c(0,0,0,1) ) # add one line to the right
pvisgam(m1, view=c("Time", "Trial"), dec=3)
par(mar=oldmar) # restore to default settings
# }
# NOT RUN {
# see the vignette for examples:
vignette("overview", package="itsadug")
# }
Run the code above in your browser using DataLab