Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Vicente Rios
Spatial and Regional Economic Analysis
Mini-Course:
Author: Vicente Rios
Vicente Rios
Practice: Spatial Weight Matrices for European
Regions
Testing Spatial Autocorrelation
Global Spatial Autocorrelation
Local Spatial Autocorrelation
Practice: Unemployment Rate Spatial
Autocorrelation Analysis
Lecture 2: Introduction Spatial Analysis
2
Vicente Rios
We are going to put in practice some of previous ideas/concepts by
developing W matrices to describe connectivity among European
NUTS-2 regions
NUTS-2 regions (Nomenclature of Territorial Units for Statistics)
NUTS2 is the territorial unit most commonly used in the literature
on regional analysis in the EU
NUTS2 regions are the basic unit for the application of cohesion
policies in the EU
(http://ec.europa.eu/regional_policy/sources/docoffic/official/repo
rts/cohesion7/7cr.pdf)
Spanish Autonomous Communities, French regions, etc..
NUTS-x refers to a level of data aggregation (3 is provinces, 0 are
countries, 1(is intermediate between country aggrregation and
regional aggregation))
Practice (W matrices)
3
Vicente Rios
Practice (W matrices)
4
Vicente Rios
In Italy there are 20 NUTS-2 regions
NUTS-2 regions
5
Vicente Rios
In Germany this is the current NUTS-2 regional division:
NUTS-2 regions
6
Vicente Rios
Switch to Matlab “Tutorial1_W_Matrices.m”
7
Vicente Rios
Goals
In a first place, we are going to use latitude and longitude
coordinates of each NUTS2 region to obtain a matrix of
distances 𝑫𝒊𝒋 in kilometers for all European regions.
Second, we will use this distance matrix 𝑫𝒊𝒋 to derive different
spatial weight matrices W using some of the spatial functional
forms we have seen before.
In particular we will derive (i) the gravity W matrix, (ii) the 5 and
25 nearest neighbors and (iii) an exponential matrix with cut-offs
at the first quartile of the distribution of distances.
Practice (W matrices)
8
Vicente Rios
Software: Matlab
We are going to use some already built in functions in this exercise:
1) distance.m→ calculates distances (in degrees) between points in a sphere
2) deg2km.m → converts degrees into kilometers
3) normw.m→ row-normalizes the matrices
4) make_nnw.m→ finds “k” nearest neighbors and builts W based on the specified k
5) spy.m→ plots the sparsity pattern of a matrix
6) vec.m→ vectorizes a matrix
7) quantile.m→ finds quantiles of the distribution of the supplied variable
8) gplot.m→ creates a network representation of a matrix
Practice (W matrices)
9
Vicente Rios
Practice (W matrices)
10
Code
Vicente Rios
(code continued)
Practice part 1
11
Vicente Rios
(code continued)
Practice (W matrices)
12
Vicente Rios
(code continued)
Practice (W matrices)
13
Vicente Rios
(code continued)
Practice Day 1
14
Vicente Rios
An interesting thing to do is to visualize how sparse or how dense is
our matrix.
In applied analysis matrix sparsity greatly accelerates computations.
Sparsity carries a number of substantive and computational advantages:
Dense matrices are noisy and contain a potentially large number of
irrelevant connections.
Dense matrices will bias downward indirect effects of a change in
observation j (the individual weights of non-zero entries in row-
standardized weight matrices will be smaller).
Dense matrices can be computationally intensive to the point that even
simple matrix operations are infeasible
Practice (W matrices)
15
Vicente Rios
Some computational facts on W sparsity:
With n = 65K
Dense Matrix = 31.9 GB of storage vs Sparse Matrix = 0.01 GB
With n = 208K
Dense Matrix = 324.8 GB of storage vs Sparse Matrix = 0.03 GB
With n = 8M (big data)
Dense Matrix = 501659.33 GB of storage vs Sparse Matrix = 1.1 GB
Ways to increase efficiency: ordering north-south or east-west
Concentrates nonzero elements around the diagonal
Log determinant of W with n=62K more than 12GB and almost infeasible in time for
most of machines
The same operation for a geographically ordered matrix takes less than a minute
Practice (W matrices)
16
Vicente Rios
Practice (W matrices)
17
Vicente Rios
K-nearest neighbor matrices
Practice (W matrices)
18
Vicente Rios
K-nearest neighbor matrices
Practice (W matrices)
19
Vicente Rios
(code continued)
Practice (W matrices)
20
Vicente Rios
The gravity matrix
Practice (W matrices)
21
Vicente Rios
Exponential decay matrices with cut-offs
Practice (W matrices)
22
Vicente Rios
5-nearest neighbor representation of NUTs-2 European regions
Practice (W matrices)
23
Vicente Rios
Practice (W matrices)
24
Vicente Rios
Indicator of spatial association
Global Autocorrelation
Local Autocorrelation
Global Autocorrelation:
It is a measure of overall clustering in the data. It yields one statistic to
summarize the whole study area.
Captures departures from random spatial distribution
Famous/Commonly employed statistics:
Moran’s I
Gery’s C
Getis and Ord’s G(d)
Testing Spatial Autocorrelation
25
Vicente Rios
Real distribution of unemployment rates in European regions (2011) vs a
spatially random distribution with the same parameters
𝑈 ~ (𝜇 = 9.4, 𝜎 = 5.25)
Real world vs spatial randomness
26
Vicente Rios
Moran’s I
This statistic is given by:
𝐼 =𝑛σ𝑖=1
𝑛 σ𝑗=1,𝑗≠𝑖𝑛 𝑤𝑖𝑗(𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
𝑆 σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
where 𝑆 = σ𝑖=1𝑛 σ𝑗=1
𝑛 𝑤𝑖𝑗 and 𝑤𝑖𝑗 is an element of the spatial weight matrix
that measures spatial distance or connectivity between regions i and j.
In matrix form:
𝐼 =𝑛
𝑆
𝑧′𝑊𝑧
𝑧′𝑧where 𝑧 = x − ҧ𝑥. If the W matrix is row-standardized, then:
𝐼 =𝑧′𝑊𝑧
𝑧′𝑧because S=n.
Values range from -1 (perfect dispersion) to +1 (perfect correlation). A zero
value indicates a random spatial pattern
Testing Spatial Autocorrelation
27
Vicente Rios
Note that:
መ𝛽𝑂𝐿𝑆 =σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 𝑦𝑖 − ത𝑦
𝑥𝑖 − ҧ𝑥 2
Therefore
𝐼 =𝑛σ𝑖=1
𝑛 σ𝑗=1,𝑗≠𝑖𝑛 𝑤𝑖𝑗(𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
𝑆 σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
I, is equivalent to the slope of coefficient of a linear regression of the
spatial Wx on the observation vector x, measured in deviation from their
means. ෪𝑊𝑋 = 𝛽1 ෨𝑋
where the tilde represents the variable is in deviation from the mean
Testing Spatial Autocorrelation
28
Vicente Rios
A very useful tool for understanding the Moran’s I test is the
Moran’s scatterplot:
Testing Spatial Autocorrelation
29
Vicente Rios
𝑥 = 𝜌𝑊𝑥 + 𝜖 → 𝑥 = (𝐼 − 𝜌𝑊)−1𝜖
Example with 𝜌 = 0.99
Testing Spatial Autocorrelation
30
Vicente Rios
𝑥 = 𝜌𝑊𝑥 + 𝜖 → 𝑥 = (𝐼 − 𝜌𝑊)−1𝜖
Example with 𝜌 = 0.00
Testing Spatial Autocorrelation
31
Vicente Rios
𝑥 = 𝜌𝑊𝑥 + 𝜖 → 𝑥 = (𝐼 − 𝜌𝑊)−1𝜖
Example with 𝜌 = −0.99
Testing Spatial Autocorrelation
32
Vicente Rios
Many spatial econometric based studies use Moran’s I to motivate the
employment of spatial econometrics to analyze a specific variable
It can be complemented by means of spatially conditioned stochastic
kernels estimates of 𝑔 𝑦|𝑊𝑦 :
𝑔 𝑦|𝑊𝑦 =𝑓(𝑦,𝑊𝑦)
𝑓(𝑦)
where 𝑔 𝑦|𝑊𝑦 is the density of y conditional on the neighbor’s values of y
The kernel 𝑔 𝑦|𝑊𝑦 is a conditional density and shows the probability that a
given region has a specific value or state of y, given their neighbor’s values.
To estimate 𝑔 𝑦|𝑊𝑦 one first estimates the joint density of f 𝑦,𝑊𝑦 and
then the marginal density 𝑓 𝑦 is calculated by integrating over y.
Testing Spatial Autocorrelation
33
Vicente Rios
Visual inspection of the kernel shape g(y|Wy) allows to observe if spatial patterns
are strong or weak.
If probability density flows along the main diagonal it means y would have had similar
values even if it have had different neighbor’s (space not relevant)
If probability density flows in paralallel to the y axis it means spatial effects are
important drivers of the observed distribution of y. (space is relevant)
Testing Spatial Autocorrelation
34
Vicente Rios
Moran’s I calculation (example of Kosfeld lecture notes)
Assume we have the following spatial arrangement of units:
and the following geo-referenced variable
Testing Spatial Autocorrelation
35
Unemployment
Region 1 8
Region 2 6
Region 3 6
Region 4 3
Region 5 2
Vicente Rios
The spatial scheme:
can be represented by the following 5 x 5 contiguity matrix:
𝑊 =
0 1 1 0 01 0 1 1 0100
110
010
101
010
We will work first with the non-standardized W
Testing Spatial Autocorrelation
36
Vicente Rios
𝐼 =𝑛σ𝑖=1
𝑛 σ𝑗=1,𝑗≠𝑖𝑛 𝑤𝑖𝑗
∗ (𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
𝑆 σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
Table 1: Cross products (𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
Testing Spatial Autocorrelation
37
UR
Region 1 8
Region 2 6
Region 3 6
Region 4 3
Region 5 2
Avg 5
Vicente Rios
Unstandardized weights
Table 2: Unstandardized weights (𝑤𝑖𝑗∗ )
Testing Spatial Autocorrelation
38
Vicente Rios
Table 3: weighted cross products: σ𝑖=1𝑛 σ𝑗=1,𝑗≠𝑖
𝑛 𝑤𝑖𝑗∗ (𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
Testing Spatial Autocorrelation
39
Vicente Rios
Table 4: Sum of squared deviations σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
Moran’s I (unstandardized weight matrix):
𝐼 =𝑛
𝑆
𝑧′𝑊𝑧
𝑧′𝑧=
5
12
18
24= 0.3125
Testing Spatial Autocorrelation
40
Vicente Rios
Opening Matlab you can reproduce these tedious calculations by
typing:
n=length(x);
xm=mean(x);
xmv=ones(n,1)*xm;
cprod1 = (x-xmv)'*W*(x-xmv); % this is Table 3
xsqr=(x-xmv)'*(x-xmv); % this is Table 4 (part of the denominator)
Wv=vec(W,2);
S=sum(Wv); %needed for the calculation of the numerator
I = [n/S]*[cprod1/xsqr]; % this is the Moran’s I value
res.I = I;
Testing Spatial Autocorrelation
41
Vicente Rios
Calculation of Moran’s I with standardized weight matrix:
𝐼 =σ𝑖=1𝑛 σ𝑗=1,𝑗≠𝑖
𝑛 𝑤𝑖𝑗(𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
The cross-products are the same as in our previous case: (𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
Testing Spatial Autocorrelation
42
Vicente Rios
The row-normalized W, however, is different:
Table 5: Standardized weights 𝑤𝑖𝑗
Table 6: Weighted cross-products𝑤𝑖𝑗(𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
Testing Spatial Autocorrelation
43
Vicente Rios
Again, the sum of squared deviations is σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2 = 24
Thus, the Moran’s I (for the standardized W) is slightly higher:
𝐼 =σ𝑖=1𝑛 σ𝑗=1,𝑗≠𝑖
𝑛 𝑤𝑖𝑗 (𝑥𝑖 − ҧ𝑥)(𝑥𝑗 − ҧ𝑥)
σ𝑖=1𝑛 𝑥𝑖 − ҧ𝑥 2
=11
24= 0.4583
Check in Matlab that by inputing the standardized W you actually
get this value.
This was the standardized W matrix
Testing Spatial Autocorrelation
44
Vicente Rios
Moran’s I statistical significance
To analyze significance of the observed spatial correlated pattern we need a Z statistic that allows
us to calculate p-values
It is given by:
𝑍 𝐼 =𝐼 − 𝐸(𝐼)
𝑉𝐴𝑅(𝐼)~𝑁(0,1)
Expected value 𝐸 𝐼 = −1
𝑛−1
Variance of I (normal aprox)
𝑉𝐴𝑅 𝐼 =𝑛2𝑆1+𝑛𝑆2+3𝑆0
2
(𝑛−1)𝑆02 − 𝐸(𝐼) 2
where:
𝑆0 =
𝑖=1
𝑛
𝑗=1
𝑛
𝑤𝑖𝑗 ; 𝑆1 =1
2
𝑖=1
𝑛
𝑗=1
𝑛
(𝑤𝑖𝑗 + 𝑤𝑗𝑖)2 ;
𝑆2 =
𝑖=1
𝑛
𝑗=1
𝑛
𝑤𝑖𝑗 +
𝑗=1
𝑛
𝑤𝑗𝑖
2
Testing Spatial Autocorrelation
45
Vicente Rios
In the example of 5 regions (n=5) we have calculated a value of Moran’s I of
0.4583 on the basis of the standardized weight matrix
Despite the small sample, we use the proportional approximation of the significance
of the Moran’s I test for illustrative purposes.
Expected value 𝐸 𝐼 = −1
𝑛−1= −0.25
𝑆0 =
𝑖=1
𝑛
𝑗=1
𝑛
𝑤𝑖𝑗 = 5
Testing Spatial Autocorrelation
46
Vicente Rios
𝑆1 =1
2
𝑖=1
𝑛
𝑗=1
𝑛
𝑤𝑖𝑗 +𝑤𝑗𝑖2
= [ 𝑤12 + 𝑤212 + 𝑤13 +𝑤31
2 + 𝑤14 +𝑤412 + 𝑤15 +𝑤51
2
+ 𝑤21 +𝑤122 + 𝑤23 +𝑤32
2 + 𝑤24 +𝑤422 + 𝑤25 +𝑤52
2
+ 𝑤31 +𝑤132 + 𝑤32 +𝑤23
2 + 𝑤34 +𝑤432 + 𝑤35 +𝑤53
2
+ 𝑤41 +𝑤142 + 𝑤42 +𝑤24
2 + 𝑤43 +𝑤342 + 𝑤45 +𝑤54
2
+ 𝑤51 +𝑤152 + 𝑤52 + 𝑤25
2 + 𝑤53 + 𝑤352 + 𝑤54 + 𝑤45
2
= [ 𝑤12 + 𝑤212 + 𝑤13 +𝑤31
2 + 𝑤14 +𝑤412 + 𝑤15 +𝑤51
2
+ 𝑤21 +𝑤122 + 𝑤23 +𝑤32
2 + 𝑤24 +𝑤422 + 𝑤25 +𝑤52
2
+ 𝑤31 +𝑤132 + 𝑤32 +𝑤23
2 + 𝑤34 +𝑤432 + 𝑤35 +𝑤53
2
+ 𝑤41 +𝑤142 + 𝑤42 +𝑤24
2 + 𝑤43 +𝑤342 + 𝑤45 +𝑤54
2
+ 𝑤51 +𝑤152 + 𝑤52 + 𝑤25
2 + 𝑤53 + 𝑤352 + 𝑤54 + 𝑤45
2
= 𝑤12 +𝑤212 + 𝑤13 + 𝑤31
2 + 𝑤21 +𝑤122 + 𝑤23 +𝑤32
2 + 𝑤24 +𝑤422 +
𝑤31 + 𝑤132 + 𝑤32 + 𝑤23
2 + 𝑤34 + 𝑤432 + 𝑤42 + 𝑤24
2 + 𝑤43 + 𝑤342 +
𝑤45 + 𝑤542 + 𝑤54 + 𝑤45
2
Testing Spatial Autocorrelation
47
Vicente Rios
= 𝑤12 +𝑤212 + 𝑤13 +𝑤31
2 + 𝑤21 + 𝑤122 + 𝑤23 +𝑤32
2
+ 𝑤24 + 𝑤422 + 𝑤31 + 𝑤13
2 + 𝑤32 + 𝑤232 + 𝑤34 + 𝑤43
2
+ 𝑤42 + 𝑤242 + 𝑤43 + 𝑤34
2 + 𝑤45 + 𝑤542 + 𝑤54 + 𝑤45
2
Recall that the standardized W is given by:
=1
2+1
3
2
+1
2+1
3
2
+1
3+1
2
2
+1
3+1
3
2
+1
3+1
3
2
+1
3+1
2
2
+1
3+1
3
2
+1
3+1
3
2
+1
3+1
3
2
+1
3+1
3
2
+1
3+ 1
2
= 4.5
Testing Spatial Autocorrelation
48
Vicente Rios
𝑆2 =
𝑖=1
𝑛
𝑖=1
𝑛
𝑤𝑖𝑗 +
𝑖=1
𝑛
𝑤𝑗𝑖
2
=
𝑖=1
𝑛
𝑤𝑖∗ + 𝑤∗𝑖2
𝑖=1
𝑛
𝑤𝑖∗ +𝑤∗𝑖2 =
= 𝑤1∗ + 𝑤∗12 + 𝑤2∗ + 𝑤∗2
2 + 𝑤3∗ + 𝑤∗32 + 𝑤4∗ + 𝑤∗4
2 + 𝑤5∗ + 𝑤∗52
= 1.16
Suming up we have:
• 𝑆0 = 5
• 𝑆1 = 4.5
• 𝑆2 =21
18= 1.16
• 𝑉𝐴𝑅 𝐼 =𝑛2𝑆1+𝑛𝑆2+3𝑆0
2
(𝑛−1)𝑆02 − 𝐸 𝐼
2= 0.0745
• 𝑍 𝐼 = 2.5955 → 𝑝 = 0.0095
Testing Spatial Autocorrelation
49
Vicente Rios
MATLAB code for the test on the statistical significance of the Moran’s I
EI=-(1./(n-1)); % expected value
S0=S; s1=zeros(n,n);
for i =1:n % loop over i
for j =1:n % loop over j
s1(i,j) = (W(i,j) + W(j,i)).^2;
end
end
s1v=vec(s1,2); S1=0.5*sum(s1v); %vectorize s1 and sum
s2=zeros(n,1);
for i= 1:n
s2(i) =([sum(W(i,:))+ sum(W(:,i))].^2);
end
S2=sum(s2);
NumVarI=(n^2)*S1-n*S2 + 3.*(S0).^2; DenVarI=(n^2-1)*(S0).^2;
VARI=(NumVarI./DenVarI)-EI^2;
Z=(I-EI)./(sqrt(VARI)); prob = norm_prb(Z);
Testing Spatial Autocorrelation
50
Vicente Rios
Testing Spatial Autocorrelation
51
Vicente Rios
If you copy previous sequence of code to calculate Moran’s I and to
calculate its significance in the Matlab editor and save it as a
function, each time you provide the function a variable x and a W
matrix, Matlab will calculate for you the corresponding values.
Testing Spatial Autocorrelation
52
Vicente Rios
Moran scatterplot (5 regions)
Testing Spatial Autocorrelation
53
Vicente Rios
The Moran’s scatterplot is a special form of a bivariate scatterplot which
makes use of the standardized values of the pairs (X,WX)
Augmented with the regression line it can be used to asses to the degree of
fit and to identify outliers
Table: Types of local spatial association
Positive spatial association: HH and LL
Negative spatial association: LH and HL (spatial outliers in case of + spatial
autocorrelation
Testing Spatial Autocorrelation
54
Spatially lagged geo-referenced variable
(WX)
High Low
Geo-referenced
variable (X)
High Quadrant I (HH) Quadrant IV(HL)
Low Quadrant II (LH) Quadrant III (LL)
Vicente Rios
Goals
Draw a Moran’s Scatterplot using of the unemployment rate in
European regions using the W matrices created previously. We will use
the 5-nearest neighbors and the exponential with cut-off at the first
quartile.
Run a OLS regression of X (unemployment rates) and WX (the
spatial lag of unemployment rates) using the two matrices with the
variables expressed in deviations with respect the sample average (or
use the originals with a constant)
Check the slopes obtained in the regression with the results of the
MoranI.m function we have coded. Is the Moran’s I statistically
significant at the 5% level ?
Practice (Global Spatial Autocorrelation)
55
Vicente Rios
Switch to Matlab“Tutorial2_Global_Spat_Autocorr.m”
56
Vicente Rios
Matlab functions
MoranI.m → function that calculates Moran’s I statistic and its
significance level
OLS_demo.m → function to perform basic OLS regression
prt.m → prints the results into the command window of a regression
structure results.
Practice (Part Global Spatial Autocorr)
57
Vicente Rios
Practice (Part Global Spatial Autocorr)
58
Vicente Rios
Moran’s scatterplot of unemployment rates in European NUTS-2
regions
Practice (Part Global Spatial Autocorr)
59
Vicente Rios
Practice (Part Global Spatial Autocorr)
60
Vicente Rios
Practice (Part Global Spatial Autocorr)
61
Vicente Rios
Main message: spatial correlation is NOT universal like time
correlation. Depends on our defenition of space and interdependence.
Finding the true W is of key importance to model real spatial associations
Practice (Part Global Spatial Autocorr)
62
Vicente Rios
Global spatial correlation summarizes the strength of spatial
dependencies by a single statistic.
LISA focuses on heterogeneity of spatial association over space.
LISA provide detailed information of spatial clustering.
LISA for each observation tells how values around that observation are
clustered.
Useful for detecting local clusters and spatial outliers.
A local cluster is characterized by a concentration of high values of an
attribute variable X. A spatial clustering of high value contiguous
region is called hot spot whereas a spatial clustering of low value
contiguous regions is called cold spot.
Spatial outliers are regions with reversed orientation compared to the
predominant global one
Local Indicators of Spatial Association (LISA)
63
Vicente Rios
We deal with one of two may well-known LISA:
The Local Moran’s I statistic
Useful for detecting spatial outliers and general clustering
formations (we focus on this one)
The Getis-Ord G statistic
Better suited for identifying specific cluster formations
Local Indicators of Spatial Association (LISA)
64
Vicente Rios
Local Moran statistic I(i) detects local spatial autocorrelation. The I(i)’s are
indicators of local instability. They decompose the Moran’s I into contributions for
each location.
According to this property, Local Moran’s I can be used for two purposes:
Indicators of local spatial clusters
Diagnostics for outliers in global spatial patterns
Local Moran’s I statistic:
𝐼𝑖 =(𝑥𝑖− ҧ𝑥) σ𝑗=1
𝑛 𝑤𝑖𝑗 𝑥𝑗− ҧ𝑥
1
𝑛σ𝑗=1𝑛 𝑥𝑗− ҧ𝑥
2
Numerator: determines the sign of I(i)
+ if both the i-th region and neighbors have above or below average values in the geo-
referenced variable X and
(-) if the i-th region as an above(below) neighboring regions have a below(above) average
values of X
Denominator: standardization of the cross-product by the variance of the georeferenced
variable X
Local Indicators of Spatial Association (LISA)
65
Vicente Rios
Below is a plot of Local Moran Z-scores for the 2004 Presidential
Elections. Higher absolute values of z scores (red) indicate the presence of
hot spots", where the percentage of the vote received by President Bush was
significantly different from that in neighboring counties.
Testing Spatial Autocorrelation
66
Vicente Rios
Example of Local Moran’s I:
We calculate Local Moran statistics with the standardized weights wij:
The sum of squared deviations from the mean has already been calculated with
the Moran’s I:
1/𝑛
𝑗=1
𝑛
𝑥𝑗 − ҧ𝑥2= 4.8
This will be our denominator in the following calculations
Local Indicators of Spatial Association (LISA)
67
Vicente Rios
Region 1
𝐼1 =(𝑥1 − ҧ𝑥)σ𝑗=1
𝑛 𝑤1𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
= 0.625
𝑗=1
𝑛
𝑤1𝑗 𝑥𝑗 − ҧ𝑥 =1
26 − 5 +
1
26 − 5 = 1
𝑥1 − ҧ𝑥 = 8 − 5
So:
𝐼1 =(𝑥1 − ҧ𝑥)σ𝑗=1
𝑛 𝑤1𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
=(3)(1)
4.8= 0.625
Local Indicators of Spatial Association (LISA)
68
Vicente Rios
Region 2
𝐼2 =(𝑥2 − ҧ𝑥)σ𝑗=1
𝑛 𝑤2𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
= 0.1389
𝑗=1
𝑛
𝑤2𝑗 𝑥𝑗 − ҧ𝑥 =1
38 − 5 +
1
36 − 5 +
1
33 − 5 =
2
3
𝑥2 − ҧ𝑥 = 6 − 5 = 1
So:
𝐼2 =(𝑥2 − ҧ𝑥)σ𝑗=1
𝑛 𝑤2𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
=1 (
23)
4.8= 0.1389
Local Indicators of Spatial Association (LISA)
69
Vicente Rios
Region 3
𝐼3 =(𝑥3 − ҧ𝑥)σ𝑗=1
𝑛 𝑤3𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
= 0.1389
𝑗=1
𝑛
𝑤3𝑗 𝑥𝑗 − ҧ𝑥 =1
38 − 5 +
1
36 − 5 +
1
33 − 5 =
2
3
𝑥3 − ҧ𝑥 = 6 − 5 = 1
So:
𝐼3 =(𝑥3 − ҧ𝑥)σ𝑗=1
𝑛 𝑤3𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
=1 (
23)
4.8= 0.1389
Local Indicators of Spatial Association (LISA)
70
Vicente Rios
Region 4
𝐼4 =(𝑥4 − ҧ𝑥) σ𝑗=1
𝑛 𝑤4𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
= 0.1389
𝑗=1
𝑛
𝑤4𝑗 𝑥𝑗 − ҧ𝑥 =1
36 − 5 +
1
36 − 5 +
1
32 − 5 = −
1
3
𝑥4 − ҧ𝑥 = 3 − 5 = −2
So:
𝐼4 =(𝑥4 − ҧ𝑥)σ𝑗=1
𝑛 𝑤4𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
=(−2)(−
13)
4.8= 0.1389
Local Indicators of Spatial Association (LISA)
71
Vicente Rios
Region 5
𝐼5 =(𝑥5 − ҧ𝑥)σ𝑗=1
𝑛 𝑤5𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
= 1.25
𝑗=1
𝑛
𝑤5𝑗 𝑥𝑗 − ҧ𝑥 = 1 3 − 5 = −2
𝑥5 − ҧ𝑥 = 2 − 5 = −3
So:
𝐼5 =(𝑥5 − ҧ𝑥)σ𝑗=1
𝑛 𝑤5𝑗 𝑥𝑗 − ҧ𝑥
σ𝑗=1𝑛 𝑥𝑗 − ҧ𝑥
2/𝑛
=(−2)(−3)
4.8= 1.25
Local Indicators of Spatial Association (LISA)
72
Vicente Rios
Does the average of local Moran’s I produce the global Moran’s I calculated
before?
Recall that from our previous example with standardized weights we have:
I = 0.4583
𝐼 =1
5
𝑖
5
𝐼𝑖 =1
50.625 + 0.1389 + 0.1389 + 0.1390 + 1.25 = 0.4583
Interpretation of the results in this example:
- A local spatial cluster is identified around region 5 and to somewhat les
around region 1, as both, 𝐼5 and 𝐼1 exceed the global Moran’s I noticeably
- Since all 𝐼𝑖 values exceed their expected value, no outlying region with
respect to the orientation is identififed
Local Indicators of Spatial Association (LISA)
73
Vicente Rios
Goals
Estimate Local Moran’s I using unemployment rates in European
regions using the exponential with cut-off at the third quartile W
matrix. Use the function “localMoranI.m”
Check that the average of the Local Moran I’s add up to the global
Moran I (you need to calculate the global Moran for these Ws)
Create a scatterplot of the estimated Local Moran I’s and another of its
estimated p-values. Is there any pattern?
Create one map of the estimated Local Moran’s I and another one of
the estimated p-values
Practice (Part Local Spatial Autocorr)
74
Vicente Rios
Switch to Matlab“Tutorial3_Local_Spat_Autocorr.m”
75
Vicente Rios
Practice (Part Local Spatial Autocorr)
76
You should obtain a global Moran’s I of 0.8797 and that the average over
Local Moran’s I is also 0.8797
Vicente Rios
Local Moran’s I Map
Practice (Part Local Spatial Autocorr)
77
Local cluster of high
unemployment rates
Vicente Rios
Some simplified insights in the south-of Spain local cluster of
unemployment:
(1) Low-valued addded specialization in agriculture (olive oil) dependent on
subsidies and strong public-sector employment share (non-market services)
(2) Distribution of land and income, highly unequal (due to historical reasons)
(1) + (2) → dependent population
(3) Socialist Party stronghold → Monopoly of political power
(4) High levels of corruption
(3) + (4) → clientelistic regime
(5) High levels of religiosity → traditional values and few entrepreneurship
(6) High levels of luminosity + nice weather → strong amenity
All together: corrupt regime with dependent population that does not migrate
to other region (there is not regional re-balancing of the labor supply)
Practice (Part Local Spatial Autocorr)
78
Vicente Rios
Practice (Part Local Spatial Autocorr)
79
Vicente Rios
Practice (Part Local Spatial Autocorr)
80
Vicente Rios
Practice (Part Local Spatial Autocorr)
81