Hi! I’m attempting to fit a CAR model following the basic example found here. Below is some code for an attempt to do the same steps for a subset of my real spatial data. Columns X and Y are UTM coordinates. When trying to fit it, I get the error mentioned in the title, and I haven’t been able to figure out what it means. Thanks for your help!
library(brms) # Read example data d <- readr::read_csv("https://raw.githubusercontent.com/maxlindmark/spatial-metabolic-index/main/car_data.csv") # set up distance and neighbourhood matrices K <- nrow(d) distance_grid <- d[, c("X", "Y")] distance <- as.matrix(dist(distance_grid)) W <- array(0, c(K, K)) W[distance == 1] <- 1 d$grp <- 1:K rownames(W) <- 1:K bm <- brm(response ~ predictor + car(W, gr = grp), data = d, data2 = list(W = W))
- Operating System: Mac OS Ventura 13.5.2 (22G91)
- brms Version: brms_2.19.0