Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cor_sar

(Deprecated) Spatial simultaneous autoregressive (SAR) structures


Description

Thse functions are deprecated. Please see sar for the new syntax. These functions are constructors for the cor_sar class implementing spatial simultaneous autoregressive structures. The lagsar structure implements SAR of the response values:

y = ρ W y + η + e

The 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.

Usage

cor_sar(W, type = c("lag", "error"))

cor_lagsar(W)

cor_errorsar(W)

Arguments

W

An object specifying the spatial weighting matrix. Can be either the spatial weight matrix itself or an object of class listw or nb, from which the spatial weighting matrix can be computed.

type

Type of the SAR structure. Either "lag" (for SAR of the response values) or "error" (for SAR of the residuals).

Details

Currently, only families gaussian and student support SAR structures.

Value

An object of class cor_sar to be used in calls to brm.

Examples

## Not run: 
data(oldcol, package = "spdep")
fit1 <- brm(CRIME ~ INC + HOVAL, data = COL.OLD, 
            autocor = cor_lagsar(COL.nb), 
            chains = 2, cores = 2)
summary(fit1)
plot(fit1)

fit2 <- brm(CRIME ~ INC + HOVAL, data = COL.OLD, 
            autocor = cor_errorsar(COL.nb), 
            chains = 2, cores = 2)
summary(fit2)
plot(fit2)

## End(Not run)

brms

Bayesian Regression Models using 'Stan'

v2.15.0
GPL-2
Authors
Paul-Christian Bürkner [aut, cre], Jonah Gabry [ctb], Sebastian Weber [ctb], Andrew Johnson [ctb], Martin Modrak [ctb]
Initial release
2021-03-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.