sar {HSAR} | R Documentation |
SAR model estimation
Description
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.
Usage
sar(
formula,
data = NULL,
W,
burnin = 5000,
Nsim = 10000,
thinning = 1,
parameters.start = NULL
)
Arguments
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
|
Value
A list
.
- cbetas
A matrix with the MCMC samples of the draws for the coefficients.
- Mbetas
A vector of estimated mean values of regression coefficients.
- SDbetas
The standard deviations of estimated regression coefficients.
- Mrho
The estimated mean of the lower-level spatial autoregressive parameter
\rho
.- SDrho
The standard deviation of the estimated lower-level spatial autoregressive parameter.
- Msigma2e
The estimated mean of the lower-level variance parameter
\sigma^{2}_{e}
.- SDsigma2e
The standard deviation of the estimated lower-level variance parameter
\sigma^{2}_{e}
.- DIC
The deviance information criterion (DIC) of the fitted model.
- pd
The effective number of parameters of the fitted model.
- Log_Likelihood
The log-likelihood of the fitted model.
- R_Squared
A pseudo R square model fit indicator.
- impact_direct
Summaries of the direct impact of a covariate effect on the outcome variable.
- impact_idirect
Summaries of the indirect impact of a covariate effect on the outcome variable.
- impact_total
Summaries of the total impact of a covariate effect on the outcome variable.
References
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
Examples
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)