sar | R Documentation |
The sar()
function implements a standard spatial econometrics model (SAR) or a spatially lagged dependent
variable model using the Markov chain Monte Carlo (McMC) simulation approach.
sar(
formula,
data = NULL,
W,
burnin = 5000,
Nsim = 10000,
thinning = 1,
parameters.start = NULL
)
formula |
A symbolic description of the model to fit. A formula for the covariate part of the model
using the syntax of the |
data |
A |
W |
The N by N spatial weights matrix or neighbourhood matrix where N is the number of spatial units.
The formulation of W could be based on geographical distances separating units or based on geographical contiguity.
To ensure the maximum value of the spatial autoregressive parameter |
burnin |
The number of McMC samples to discard as the burnin period. |
Nsim |
The total number of McMC samples to generate. |
thinning |
MCMC thinning factor. |
parameters.start |
A list with names "rho", "sigma2e", and "beta" corresponding to initial values for the model parameters
|
A list
.
A matrix with the MCMC samples of the draws for the coefficients.
A vector of estimated mean values of regression coefficients.
The standard deviations of estimated regression coefficients.
The estimated mean of the lower-level spatial autoregressive parameter \rho
.
The standard deviation of the estimated lower-level spatial autoregressive parameter.
The estimated mean of the lower-level variance parameter \sigma^{2}_{e}
.
The standard deviation of the estimated lower-level variance parameter \sigma^{2}_{e}
.
The deviance information criterion (DIC) of the fitted model.
The effective number of parameters of the fitted model.
The log-likelihood of the fitted model.
A pseudo R square model fit indicator.
Summaries of the direct impact of a covariate effect on the outcome variable.
Summaries of the indirect impact of a covariate effect on the outcome variable.
Summaries of the total impact of a covariate effect on the outcome variable.
Anselin, L. (1988). Spatial Econometrics: Methods and Models. Dordrecht: Kluwer Academic Publishers.
LeSage, J. P., and R. K. Pace. (2009). Introduction to Spatial Econometrics. Boca Raton, FL: CRC Press/Taylor & Francis
data(landprice)
head(landprice)
data(land)
# extract the land parcel level spatial weights matrix
library(spdep)
library(Matrix)
nb.25 <- spdep::dnearneigh(land,0,2500)
# to a weights matrix
dist.25 <- spdep::nbdists(nb.25,land)
dist.25 <- lapply(dist.25,function(x) exp(-0.5 * (x / 2500)^2))
mat.25 <- spdep::nb2mat(nb.25,glist=dist.25,style="W")
W <- as(mat.25,"dgCMatrix")
## run the sar() function
res.formula <- lnprice ~ lnarea + lndcbd + dsubway + dpark + dele +
popden + crimerate + as.factor(year)
betas= coef(lm(formula=res.formula,data=landprice))
pars=list(rho = 0.5, sigma2e = 2.0, betas = betas)
res <- sar(res.formula,data=landprice,W=W,
burnin=500, Nsim=1000, thinning=1,
parameters.start=pars)
summary(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.