Hi,
I want to use brms to fit a model on data from spatial polygons. I want to use CAR to account for autocorrelation in the response. Unfortunately my adjacency matrix is too large to fit into memory, that is I can compute it but brms returns the error (with traceback) when I fit the model.
cannot allocate vector of size 20.8 Gb
▆
- └─brms::brm(…)
- └─brms:::validate_data2(…)
-
└─brms:::validate_car_matrix(get_from_data2(M, data2))
-
└─Matrix::Matrix(M, sparse = TRUE)
-
└─methods::as(data, if (sparse) "CsparseMatrix" else "unpackedMatrix")
-
└─Matrix (local) asMethod(object)
-
└─Matrix:::.m2sparse.checking(from, ".", "C")
-
├─base::isSymmetric(from, ...)
-
├─base::isSymmetric(from, ...)
-
└─base::isSymmetric.matrix(from, ...)
-
├─base::all.equal(object, t(object), tolerance = tol, ...)
-
└─base::all.equal.numeric(object, t(object), tolerance = tol, ...)
-
└─base::as.vector(current)
Is there a way to use a sparse matrix representation for the adjacency matrix in brms? From the traceback it seems like brms already transforms the matrix into a sparse one but then the object should be smaller.
Thanks!
Jonathan