Hi all,
I am trying to include a Gaussian process on longitude/latitude sampling coordinates in a hierarchical model. Samples cover two years and I want to model spatial correlation within each year only, so I’m using the “by = Year” term in brms to fit a separate GP for each year. There are a number of duplicate coordinates within each year which I would like to assign the same latent variable by using the “gr = TRUE” argument. However, doing so causes LOO and general posterior draw functions to return the following error:
Error in as_draws_matrix(gp[[“Cgp”]], dim = dim(eta)) :
length(x) %in% c(1, dim[2]) is not TRUE
It seems that the dimensions of the contrasts for the sub-GPs are not equal to 2 as expected. Disabling the “gr” argument fixes the error on a small subset of the data, but
returns a different error on the full data about the covariance matrix not being positive definite. In any case, it does not seem appropriate to disable the grouping option given the data structure.
Any ideas on what could be causing this error?
Thanks in advance!
- Operating System: Windows 10
- brms Version: 2.12.0