$$y = X \beta + u, u = \lambda W u + \varepsilon$$
where $\lambda$ is found by optimize()
first and $\beta$ and other
parameters by generalized least squares subsequently.
errorsarlm(formula, data=list(), listw, method="eigen", quiet=TRUE,
zero.policy=FALSE, tol.solve=1.0e-7, tol.opt=.Machine$double.eps^0.5,
sparsedebug=FALSE)
sar.error.f(lambda, eig, y, wy, x, WX, n, quiet)
sar.error.f.s(lambda, sn, y, wy, x, WX, n, quiet, 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
.errorsarlm()
to terminate with an errorsolve()
(default=1.0e-7)optimize()
(default=square root of double precision machine tolerance)eigenw
listw2sn
sarlm
lm
object returned when estimating for $\lambda=0$lm
object returned for the GLS fitWhen using the sparse method, the user takes (unfortunately) full
responsibility for possible failures, including R terminating with
a core dump! Safeguards have been put in place to try to trap errant
behaviour in the sparse functions' memory allocation, but they may
not always help. When sparsedebug is TRUE, a log file (sparsestats)
is written in the working directory - the figure of interest is the
number of allocated blocks. At present, spwdet
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
, lagsarlm
,
eigenw
, log.spwdet
, predict.sarlm
,
residuals.sarlm
data(oldcol)
COL.err.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb), method="eigen", quiet=FALSE)
COL.err.sp <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb), method="sparse", quiet=FALSE)
summary(COL.err.eig)
summary(COL.err.sp)
Run the code above in your browser using DataLab