$$y = \rho W y + X \beta + \varepsilon$$
where $\rho$ is found by optimize()
first and $\beta$ and other
parameters by generalized least squares subsequently. In the mixed model,
the spatially lagged independent variables are added to X.
lagsarlm(formula, data=list(), listw, type="lag", method="eigen", quiet=TRUE,
zero.policy=FALSE, tol.solve=1.0e-7, tol.opt=.Machine$double.eps^0.5,
sparsedebug=FALSE)
sar.lag.mixed.f.s(rho, sn, e.a, e.b, e.c, n, quiet, sparsedebug)
sar.lag.mixed.f(rho, eig, e.a, e.b, e.c, n, quiet)
dosparse(listw, y, x, wy, K, quiet, tol.opt, sparsedebug)
lm()
listw
object created for example by nb2listw
eigenw
, and "sparse" - computes the
determinant of the sparse matrix (I - rho*W) directly using log.spwdet
.lagsarlm()
to terminate with an errorsolve()
(default=1.0e-7). This may be used if necessary to extract coefficient standard errors, but errors in solve()
do constioptimize()
(default=square root of double precision machine tolerance)eigenw
listw2sn
sarlm
lm
object returned when estimating for $\rho=0$lm
object returned for the GLS fitspwdet
will fail when
this increases over the number initially allocated, but will not release
memory allocated by the sparse functions. In the event of problems,
save your workspace and quit R. Problems seem to be related to larger
n, and to an unknown trigger precipitating incontrolled fillin, in the
course of which the sparse routines lose track of their memory pointers,
and then provoke a segmentation fault trying to free unallocated memory.lm
, errorsarlm
,
eigenw
, log.spwdet
, predict.sarlm
,
residuals.sarlm
data(oldcol)
COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb), method="eigen", quiet=FALSE)
COL.lag.sp <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb), method="sparse", quiet=FALSE)
summary(COL.lag.eig)
summary(COL.lag.sp)
Run the code above in your browser using DataLab