data(simdat)
# Model with random effect and interactions:
m1 <- bam(Y ~ te(Time, Trial)+s(Time, Subject, bs='fs', m=1),
data=simdat)
# Plot summed effects:
vis.gam(m1, view=c("Time", "Trial"), plot.type='contour', color='topo')
# Same plot:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=FALSE)
# Without random effects included:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE)
# Notes on the color legend:
# Labels can easily fall off the plot, therefore the numbers can be
# automatically rounded.
# To do the rounding, set dec=-1:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE,
dec=-1)
# For custom rounding, set dec to a value:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE,
dec=0)
# 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
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE,
dec=3)
par(mar=oldmar) # restore to default settings
# Using transform
# Plot log-transformed dependent predictor on measurement scale:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE, transform=exp)
# Notes on transform.view:
# This will generate an error, because x-values <= 0 will result in NaN:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE,
transform.view=list(log, NULL))
# adjusting the x-axis helps:
fvisgam(m1, view=c("Time", "Trial"), rm.ranef=TRUE,
xlim=c(1,2000), transform.view=list(log, NULL))
# see the vignette for examples:
vignette("inspect", package="itsadug")
Run the code above in your browser using DataLab