[R-sig-Geo] bivariate spatial correlation in R

Roger Bivand Roger.Bivand at nhh.no
Wed Jul 26 12:07:00 CEST 2017


On Wed, 26 Jul 2017, Rafael Pereira wrote:

> Roger,
>
> This example was provided only for the sake or making the code easily
> reproducible for others and I'm more interested in how the bi-variate Moran
> could be implemented in R, but your comments are very much welcomed and
> I've made changes to the question.
>
> My actual case study looks at bi-variate spatial correlation between (a)
> average household income per capita and (b) proportion of jobs in the city
> that are accessible under 60 minutes by transit. I don't think I could use
> rates in this case but I will normalize the variables using
> scale(data$variable).

Please provide a reproducible example, either with a link to a data 
subset, or using a builtin data set. My guess is that you do not need 
bi-variate spatial correlation at all, but rather a spatial regression.

The "causal" variable would then the the proportion of jobs accessible 
within 60 minutes by transit, though this is extremely blunt, and lots of 
other covariates (demography, etc.) impact average household income per 
capita (per block/tract?). Since there are many missing variables in your 
specification, any spatial correlation would be most closely associated 
with them (demography, housing costs, education, etc.), and the choice of 
units of measurement would dominate the outcome.

This is also why bi-variate spatial correlation is seldom a good idea, I 
believe. It can be done, but most likely shouldn't, unless it can be 
motivated properly.

By the way, the weighted and FDR-corrected SAD local Moran's I p-values of 
the black/white ratio for Oregon (your toy example) did deliver the goods 
- if you zoom in in mapview::mapview, you can see that it detects a rate 
hotspot between the rivers.

Roger

>
> best,
>
> Rafael H M Pereira
>
> On Mon, Jul 24, 2017 at 7:56 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>> On Mon, 24 Jul 2017, Rafael Pereira wrote:
>>
>> Hi all,
>>>
>>> I would like to ask whether some you conducted bi-variate spatial
>>> correlation in R.
>>>
>>> I know the bi-variate Moran's I is not implemented in the spdep library.
>>> I left a question on SO but also wanted to hear if anyone if the mainlist
>>> have come across this.
>>> https://stackoverflow.com/questions/45177590/map-of-bivariat
>>> e-spatial-correlation-in-r-bivariate-lisa
>>>
>>> I also know Roger Bivand has implemented the L index proposed by Lee
>>> (2001)
>>> in spdep, but I'm not I'm not sure whether the L local correlation
>>> coefficients can be interpreted the same way as the local Moran's I
>>> coefficients. I couldn't find any reference commenting on this issue. I
>>> would very much appreciate your thoughts this.
>>>
>>
>> In the SO question, and in the follow-up, your presumably throw-away
>> example makes fundamental mistakes. The code in spdep by Virgilio
>> Gómez-Rubio is for uni- and bivariate L, and produces point values of local
>> L. This isn't the main problem, which is rather that you are not taking
>> account of the underlying population counts, nor shrinking any estimates of
>> significance to accommodate population sizes. Population sizes vary from 0
>> to 11858, with the lower quartile at 3164 and upper 5698:
>> plot(ecdf(oregon.tract$pop2000)). Should you be comparing rates in stead?
>> These are also compositional variables (sum to pop2000, or 1 if rates) with
>> the other missing components. You would probably be better served by tools
>> examining spatial segregation, such as for example the seg package.
>>
>> The 0 count populations cause problems for an unofficial alternative, the
>> black/white ratio:
>>
>> oregon.tract1 <- oregon.tract[oregon.tract$white > 0,]
>> oregon.tract1$rat <- oregon.tract1$black/oregon.tract1$white
>> nb <- poly2nb(oregon.tract1)
>> lw <- nb2listw(nb)
>>
>> which should still be adjusted by weighting:
>>
>> lm0 <- lm(rat ~ 1, weights=pop2000, data=oregon.tract1)
>>
>> I'm not advising this, but running localmoran.sad on this model output
>> yields SAD p-values < 0.05 after FDR correction only in contiguous tracts
>> on the Washington state line in Portland between the Columbia and
>> Williamette rivers. So do look at the variables you are using before
>> rushing into things.
>>
>> Hope this clarifies,
>>
>> Roger
>>
>>
>>> best,
>>>
>>> Rafael HM Pereira
>>> http://urbandemographics.blogspot.com
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> 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; e-mail: Roger.Bivand at nhh.no
>> Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
>> http://orcid.org/0000-0003-2392-6140
>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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; e-mail: Roger.Bivand at nhh.no
Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-sig-Geo mailing list