[R-sig-Geo] Local indicators for categorical data - spatial analysis
Roger Bivand
Roger.Bivand at nhh.no
Wed Feb 11 13:34:36 CET 2015
On Wed, 11 Feb 2015, JLong wrote:
> Hi Guilherme,
>
> Send me an email to jed.long at st-andrews.ac.uk
> I think I have some software/code that Barry Boots developed way back then
> somewhere on my machine...
LICD are not implemented, but you can get part of the way (just the
tabulations) by:
library(spdep)
data(oldcol)
HICRIME <- cut(COL.OLD$CRIME, breaks=c(0,35,80), labels=c("low","high"))
names(HICRIME) <- rownames(COL.OLD)
lw <- nb2listw(COL.nb, style="B")
joincount.multi(HICRIME, lw)
for a global baseline, and
Vis <- lapply(1:length(HICRIME), function(i) listw2star(lw, i, "B",
n=length(HICRIME), D=NULL, a=NULL))
ljcs <- t(sapply(Vis, function(x) { res <- joincount.multi(HICRIME, x,
zero.policy=TRUE); res[-nrow(res),1]}))
There are warnings because inference fails (as it should), but the tally
is the same, with:
apply(ljcs, 2, sum)/2
giving the counts of joins by type, dropping double-counting in the
summation. listw2star() is used in localmoran.sad() and elsewhere to
generate observation-wise weights objects. This isn't an implementation of
LICD in that the subregion for each i is simply its set of neighbours, not
a moving window, but at least provides a basis for classification.
As with other LISA, it is important to remove the effects of covariates,
so that an inferential approach might be based on GLM residuals (just a
speculation).
Hope this helps,
Roger
>
> Cheers,
> Jed
>
>
>
>
> -----
> Jed Long
> Lecturer in GeoInformatics
> Department of Geography & Sustainable Development
> University of St Andrews, UK
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Local-indicators-for-categorical-data-spatial-analysis-tp7587775p7587776.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list