# NOT RUN {
data(simdat)
# }
# NOT RUN {
m1 <- bam(Y ~ Group + te(Time, Trial, by=Group)
+ s(Time, Subject, bs='fs', m=1),
data=simdat, discrete=TRUE)
plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')))
# in this model, excluding random effects does not change the difference:
plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')),
rm.ranef=TRUE)
# simultaneous CI:
plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')),
rm.ranef=TRUE, sim.ci=TRUE)
# Reversed y-axis (for EEG data) and no shading:
plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')),
eegAxis=TRUE, shade=FALSE)
plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')),
density=15, angle=90, ci.lwd=3)
# Retrieving plot values...
out <- plot_diff(m1, view='Time', comp=list(Group=c('Children', 'Adults')),
plot=FALSE)
#... which might be used for indicating differences:
x <- find_difference(out$est, out$se, f=1.96, xVals=out$xVals)
# add lines:
arrows(x0=x$start, x1=x$end, y0=0, y1=0,code=3, length=.1, col='red')
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab