Hi,
The issue with AA being singular happens at the current INLA version when using PARDISO.
For now, please try the following code:
### doing the type 4 (step by step)
R.t <- crossprod(diff(Diagonal(m)))
R.s <- Diagonal(n, colSums(graph))-graph
st.C <- kronecker(R.t, R.s)
str(head(dat,2), , 30)
kronecker(matrix(1,1,3), diag(4)) ### each area sum-to-zero constraint type
kronecker(diag(3), matrix(1,1,4)) ### each time sum-to-zero constraint type
f4 <- y ~ f(time, model='ar1') + ##bym2', graph=tgraph) +
f(space, model='bym2', graph=graph) +
f(spacetime, model='generic0', Cmatrix=st.C,
extraconstr=list(A=rbind(kronecker(matrix(1, 1, m), diag(n))[-1,],
kronecker(diag(m), matrix(1, 1, n))),
e=rep(0, n+m-1)))
res4 <- inla(f4, 'poisson', E=dat$expected,
data=dat[c('space', 'time', 'spacetime', 'y')],
verbose=TRUE)
### control.inla=list(strategy='gaussian')) ## use this if using PARDISO (will be solved in the next INLA versions)
best regards,
Elias