[R-sig-Geo] Using neighbours outside the area of analysis for constructing spatial weight matrices

Roger Bivand Roger.Bivand at nhh.no
Wed Feb 9 08:21:09 CET 2011


On Tue, 8 Feb 2011, alfonso echazarra wrote:

> Hi, For what you have said, it seems that the problem I encountered 
> extends to selecting subsets of the area analysed. I assume that for 
> selecting a subsample only the spatial weights of that subsample are to 
> be computed and not for the whole area. Which means that if the subset 
> is based on a non-geographical variable (i.e. lets say "% of higher 
> degree"), the are would look like a gruyere cheese. Is that right?

Please don't assume. You have not established that edge effects are a 
problem, and your approach is non-standard, so needs motivation. You have 
not said if you are testing, modelling, or why this is an issue for you.

Your analysis of the implementation in localmoran.sad() and 
localmoran.exact() is wrong - one may often need I_i for just one zone in 
a set of zones 1:n, it is, after all, a local measure, and that measure 
will include all j of i's neighbours. So if you have position and 
attribute data for the whole data set, both inside and outside your city 
limits, you can select only zones belonging to the city, and their 
neighbours, also outside the city, will be used in calculating the I_i. 
The same would apply if other selection schemes were used.

You have also misunderstood where in the workflow the spatial weights 
appear in spdep - they are pre-computed as an nb object, then converted to 
a listw object, which is a sparse representation of the weights, all 
before any testing or modelling takes place. This means that the input 
listw and data/model objects must conform in all cases, not least because 
the weights and the data have the same ordering, and are matched by order 
index, and because a weight w_{ij} * NA is NA, which is a critical 
problem, and so largely barred.

Roger

>
> Thanks,
> Alfonso Echazarra
>
>
>
>
> ________________________________
> De: Roger Bivand <Roger.Bivand at nhh.no>
> Para: alfonso echazarra <aechazarra at yahoo.com>
> CC: r-sig-geo at stat.math.ethz.ch
> Enviado: mar,8 febrero, 2011 15:27
> Asunto: Re: [R-sig-Geo] Using neighbours outside the area of analysis for 
> constructing spatial weight matrices
>
> On Tue, 8 Feb 2011, alfonso echazarra wrote:
>
>> Hello,
>> 
>> I am constructing a spatial weight matrix and would like to use neighbours that 
>> are not part ofthe area I am analysing. In this case, I am investigating crime 
>> rates within Madrid and I would like to use Madrid's adjacent census tracts to 
>> construct the spatial weights for census tracts on the edge of Madrid (queen 
>> contiguity rule). Is that possible? Spatial weights matrices and dataset that 
>> are analysed need to be of same size?
>> 
>
> With very few exceptions, they need to be of the same size. The exception is 
> that localmoran.sad() and localmoran.exact() take a select= argument to select 
> the zones to be tested, but even here the length of the nb object and the number 
> of observations must agree - you just do not have to compute local Moran's I for 
> all of the observations. My impression is that the distributional assumptions 
> behind the tests would be affected if some of the x_j were omitted from 
> computation but included in the spatial lags through w_{ij}. It may be possible 
> to construct a lagged variable for inclusion in a regression, but I'm not sure 
> whether this would address the edge effects you seem to be concerned about.
>
> Roger
>
>> 
>> Thanks,
>> Alfonso Echazarra
>> 
>> 
>> 
>>
>>     [[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
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list