spatial neighbour
object representation
(similar to the S-PLUS spatial statististics module representation of a
listw
spatial weights object. The object is used in calculating the
Jacobian of the likelihood functions of spatial autoregressive models when
the "sparse" method is chosen in errorsarlm
and lagsarlm
.listw2sn(listw)
spwdet(sparseweights, rho, debug=FALSE)
log.spwdet(sparseweights, rho, debug=FALSE)
listw
object from for example nb2listw
spatial.neighbour
objectspatial.neighbour
:log.spwdet
returns log det(I - rho * W).When 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' memmory 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.
Files: src/spAllocate.c, src/spBuild.c, src/spConfig.h, src/spDefs.h, src/spFactor.c, src/spMatrix.h, src/spUtils.c are by Kenneth Kundert and Alberto Sangiovanni-Vincentelli, University of California, Berkeley, and are from:
(Kenneth Kundert, Sparse Matrix Techniques, in Circuit Analysis, Simulation and Design, Albert Ruehli (Ed.), North-Holland, 1986)
They are copyright (c) 1985,86,87,88 by Kenneth S. Kundert and the University of California, with the following licence:
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the copyright notices appear in all copies and supporting documentation and that the authors and the University of California are properly credited. The authors and the University of California make no representations as to the suitability of this software for any purpose. It is provided "as is", without express or implied warranty.
nb2listw
, errorsarlm
,
lagsarlm
data(columbus)
col.listw <- nb2listw(col.gal.nb)
col.listw$neighbours[[1]]
col.listw$weights[[1]]
col.sn <- listw2sn(col.listw)
col.sn[col.sn[,1] == 1,]
rho <- seq(-0.8, 0.9, 0.1)
for (i in rho) print(paste("rho:", i, "log(det(I - rho*W))",
log.spwdet(col.sn, i)), quote=TRUE)
Run the code above in your browser using DataLab