$$y = \rho W1 y + X \beta + u, u = \lambda W2 u + \varepsilon$$
where $\rho$ and $\lambda$ are found by nlminb or optim() first, and $\beta$ and other parameters by generalized least squares subsequently
sacsarlm(formula, data = list(), listw, listw2 = NULL, na.action, type="sac",
method = "eigen", quiet = NULL, zero.policy = NULL, tol.solve = 1e-10,
llprof=NULL, control = list())lm()listw object created for example by nb2listwlistw object created for example by nb2listw, if not given, set to the same spatial weights as the listw argumentoptions("na.action")), can also be na.omit or na.exclude with consequences for residuals and fitted values - in these cases the weights list will be subsetted to remove NAs in the data. It may be listw; when "sacmixed", the lagged intercept is dropped for spatial weights style "W", that is row-standardiseeigenw, and "spam" or "Matrix" for strictly symmetric weights lists of styles "B" and "C", or made symmetric by similarity (Ord, 1975, Appendix C) if psacsarlm() to terminate with an errorsolve() (default=1.0e-10). This may be used if necessary to extract coefficient standard errors (for instance lowering to 1e-12), but errorssarlmlm object returned when estimating for $\rho=0$lm object returned for the GLS fitoptim used to calculate Hessian at optimumgstsls, which lie in a central part of the help,data(oldcol)
COL.sacW.eig <- sacsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb, style="W"))
summary(COL.sacW.eig, correlation=TRUE)
W <- as(as_dgRMatrix_listw(nb2listw(COL.nb, style="W")), "CsparseMatrix")
trMatc <- trW(W, type="mult")
summary(impacts(COL.sacW.eig, tr=trMatc, R=2000), zstats=TRUE, short=TRUE)
COL.msacW.eig <- sacsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb, style="W"), type="sacmixed")
summary(COL.msacW.eig, correlation=TRUE)
summary(impacts(COL.msacW.eig, tr=trMatc, R=2000), zstats=TRUE, short=TRUE)Run the code above in your browser using DataLab