I am attempting to create a neighborhood matrix (
spdep) in R to use either for a GAM or an INLA.
As I have spatio-temporal data, counties appear multiple times over time. However, there is not always data available for every county in every year. In order for the neighborhood matrix to work in R, I need to delete the rows with NAs. As neighborhood does not change over time, my attempt was to create a neighborhood matrix with the unique county ids and unique geometries (polygons). In my opinion, it would not make sense to make to include the same county twice if the overall neighborhood stays the same over time. This approach worked with GAM. I included the unique neighborhood matrix and included a dummy matrix for years.
However, INLA is not satisfied with the unique values. But otherwise, a county would have the same neighbors multiple times in the matrix. This might be unproblematic, however I am lacking insights.