Set up an spatial simultaneous autoregressive (SAR) term in brms. The function does not evaluate its arguments – it exists purely to help set up a model with SAR terms.
An object specifying the spatial weighting matrix.
Can be either the spatial weight matrix itself or an
object of class
Type of the SAR structure. Either
lagsar structure implements SAR of the response values:
y = ρ W y + η + e
errorsar structure implements SAR of the residuals:
y = η + u, u = ρ W u + e
In the above equations, η is the predictor term and e are
independent normally or t-distributed residuals. Currently, only families
student support SAR structures.
An object of class
'sar_term', which is a list
of arguments to be interpreted by the formula
parsing functions of brms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Not run: data(oldcol, package = "spdep") fit1 <- brm(CRIME ~ INC + HOVAL + sar(COL.nb, type = "lag"), data = COL.OLD, data2 = list(COL.nb = COL.nb), chains = 2, cores = 2) summary(fit1) plot(fit1) fit2 <- brm(CRIME ~ INC + HOVAL + sar(COL.nb, type = "error"), data = COL.OLD, data2 = list(COL.nb = COL.nb), chains = 2, cores = 2) summary(fit2) plot(fit2) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.