I am a STAN beginner, so I would like to know whether STAN can handle a hierachical spatio temporal model.
y\left ( s,t \right )=z\left ( x,t \right )\beta+\xi\left ( x,t \right )+\epsilon
\xi\left ( x,t \right )=a\xi\left ( x,t-1 \right )+\omega\left ( x,t \right )
\omega follows a multivariate gaussian distribution with zero mean and a matern defined covriance matrix.
It is clear that this model can be done in INLA (grouped AR1 model), but I intend to run this model through a sampling approach rather than an approximation.
Could STAN handle this model?
More clearly, I do not know how to deal with the second stage of this model, how I multiply the separatable covariance matrices.
(Just FYI, LaTeX now works on the discourse (!!!), so you can wrap equations in $s to get it to render maths
In the case where the noise is Gaussian, the INLA method is exact up to the integration over the hyperparameters, so the solution you get there will probably be as good (if not better) than the one you get out of Stan.
Stan is a programming language, so you can just program up the model in the same way you wrote it:
model {
for (t in 2:T)
xi[n] ~ multi_normal_c( a * xi[t-1], K);
}
where K is the covariance matrix of the GP. You’ll probably have ot do some tricks (like the noncentering described in the GP chapter of the manual) to make it run well.
I am trying to run a similar model in stan but no luck. I am not sure if multi_normal_c function is still available on stan. Is it a typo or what? Also, is xi[n] a typo?