Just to complete the story:
Elias' note that there was a typo in the specification
of tgraph didn't solve the crash problem for me. (I'm
curious: do others experience the inla crash either with
or without the tgraph correction?) In a personal
communication he suggested adding
control.inla=list(strategy='gaussian')
to the knmodels call. This worked for me (though
I don't understand why).
So a working version of the knmodels help-page
example is:
tgraph <- sparseMatrix(i=c(2:10, 1:9), j=c(1:9, 2:10), x=1)
res <- inla.knmodels(y ~ f(time, model='bym2', graph=tgraph) +
f(space, model='bym2', graph=graph),
data=dat, family='poisson', E=dat$E, progress=TRUE,
spacetime=spacetime, graph=graph,
type=c(4, '4c', '4d')),
control.compute=list(dic=TRUE, waic=TRUE, cpo=TRUE),
control.inla=list(strategy='gaussian'))
Thanks to Elias Krainski for all his help!