SPATIAL ECONOMETRICS
PROGRAM PASCA SARJANA ILMU EKONOMI
UNIVERSITAS INDONESIA
23 Oktober 2012
Ordinary Least Squares
y = Xβ + ε
y: Dependent variable (Land Price)
X: independent (explanatory) variables (Center of
CBD)
β: regression coefficients
ε: random error term
• OLS estimates found by minimizing the sum of
squared prediction errors.
• Assumptions
– error has mean zero
– error terms are uncorrelated
– error terms have a constant variance
(homoskedastic)
– error term follows a normal distribution, N(0, σ2).
Asumsi dilanggar
Dalam Model
Regional /Spasial
Spatial Dependence
• Autocorrelation does not only occur in time
series analysis, but also over space, where
error terms in a spatial unit correlate with error
terms in another spatial unit
• The dependency of the error term over space is
generally called spatial autocorrelation 
Spatial Dependence
• Occurred in applied empirical and in
geographical analysis autocorrelation (Anselin
and Rey, 1991; Anselin and Griffith, 1988;
Siebert, 1975).
When is this an issue in regression analysis?
• Lets say that you have multivariate spatial data and you are
looking for relationships between the variables
• You can use regression to find relationships as we have been
doing so far in the course. However, if there is spatial
autocorrelation in the residuals  your model is
systematically overestimating the observed values in some
regions, and underestimating the observed values in other
regions  get unrealistic values for the significance and
confidence limits for the coefficients
• Why? Because, OLS assumes the cases are all independent.
If there is correlation between them, they are not independent
 your estimate of the number of degrees of freedom is too
high, and your estimate of the standard errors will be too low
 lead you to believe that some coefficients are significant,
when in fact they are not.
What is spatial autocorrelation?
• First law of geography: “everything is related to everything else, but near
things are more related than distant things” – Waldo Tobler
• Spatial autocorrelation is said to exist when a variable exhibits a regular
pattern over space in which its value at a set location depends on the
values of the same variables at other locations (Odland, 1988:7)
• What happens at one location is related to what happens at other locations
(Gatrell, 1979). The value at any one point in space is dependent on
values at the surrounding points. The arrangement of values is not just
random
• Dependency caused by: clusters, contiguity, externalities, interaction, spill-
overs, heterogeneity
• Positive spatial correlation means that similar values tend to be near each
other. Negative spatial correlation means that different values tend to be
near each other.
Spatial Autocorrelation as missing
variables
• Spatial autocorrelation arises as the manifestation of the
missing variable problem, improper structural form, or
measurement error problem
• The absence of the analysis of spatial factors in the
model makes it difficult to interpret the results of an
Ordinary Least Square (OLS) model, making the t-test
and an assessment of sampling variability unreliable
• Ignoring the spatial error structure:
• OLS is unbiased but inefficient,
• standard errors and t-tests biased
Regression diagnostics: Spatial autocorrelation
• Observations from different locations for the error term
are autocorrelated.
• If spatial autocorrelation is ignored, then all inference
(including t and F statistics, and R2) based on the
standard regression model will be incorrect.
• Moran’s I and Langrange multiplier (LM) tests – require
normality of the error terms.
• Robust Langrange multiplier test
• does not require normality of the error terms
• may not have much power for small data sets.
• If normality is satisfied, use LM statistics for ‘error’ and
‘lag’.
Pattern over Space: Similarity and
Dissimilarity
• Spatial autocorrelation is said to exist when a variable
exhibits a regular pattern over space in which its value
at a set location depends on the values of the same
variables at other locations (Odland, 1988:7)
• What happens at one location is related to what
happens at other locations (Gatrell, 1979). The regular
pattern can be one of similarity or dissimilarity.
• Dependency caused by: clusters, contiguity,
externalities, interaction, spill-overs, heterogeneity
ML spatial lag model
y = ρWy + Xβ + ε
y : Dependent variable (eg. Harga Tanah)
X : independent (explanatory) variables (Pusat Pertokoan,
Perkantoran, dll
Β : regression coefficients
Ε : random error term
ρ : Spatial autoregressive coefficient
Wy : spatially lagged dependent variable
ML spatial error model
y = Xβ + ε, where ε = λWε + ξ
Y : Dependent variable (Harga Tanah)
X : independent (explanatory) variables (Pusat Pertokoan,
CBD, dll.
housing)
Β : regression coefficients
ε : random error term
λ : autoregressive coefficient
Wε: spatial lag for the errors
ξ : normal distribution with mean 0 and variance σ2I
ξγε 1
)( −
−= WITotal effect:
Measures of fit: R2
Measure the extent to which the predicted values match
the observed values for the dependent variable
•Calculated by R2 = 1 - RSS / SST
•Model with highest R2 = best (subject to diagnostics)
•Problem: increases with additional (explanatory)
variables – overfitting – adjusted R2
•For spatial error model, use pseudo R2 because R2 is not
applicable. Pseudo R2 = ratio of the variance of the
predicted values over the variance of the observed values
for the dependent variable
Maximum likelihood (ML) estimates
• ML estimates for the parameters = those values that
obtain the highest probability or joint likelihood.
• Based on the assumption of normal error terms.
• Standard regression: OLS and ML estimates are the same
to compare models of standard and spatial regression, use
ML based measures of fit instead of R2.
• Model with highest log likelihood = best (subject to
diagnostics)
• To deal with the problem of overfitting, use Akaike
Information Criterion (AIC)
• Model with lowest AIC = best (subject to diagnostics)
• use Schwartz Criterion (SC), which is similar to AIC
t-statistic
For checking the significance of individual regression
coefficients, β.
•Estimate of β divided by its standard deviation, follows a t
distribution with n (=no. Of observations - number of
parameters estimated in the model) degrees of freedom.
•Check probability, p, of the t-statistic if p<0.05, then β ≠ 0
at the 5% significance level.
•For checking the significance of the regression specification,
as a whole.
•Check probability, p, of the F-statistic: – usually significant
except for very poor model specification (in which case also
indicated by R2).
Example
• Imagine if you had data from 10 counties spread all over the
northeast. The data includes variables such as median income, # of
highways, and access to the internet
• You regress access to the internet (dependent variable) against the
other two (independent) variables. You realize that n=10 is not
enough to get significant results, so you need more data, get data
from 10 additional counties, but you choose the counties that are
immediately adjacent to the original 10
• If incomes and infrastructure hardly change from one county to the
next, you are not really getting any additional information. This would
be spatial autocorrelation
• So how does this affect the regression results? You would be doing
the calculations as if you had n=20 cases, but in reality you only had
10 independent cases. So, you would be overestimating the number
of degrees of freedom, getting unrealistic t and p values, and
underestimating the standard errors of the coefficients.
Moran’s I
• One of the oldest indicators of spatial autocorrelation (Moran, 1950).
Still a defacto standard for determining spatial autocorrelation
• Applied to zones or points with continuous variables associated with
them.
• Compares the value of the variable at any one location with the value
at all other locations
,
2
,
( )( )
( ) ( )
i j i ji j
i j ii j i
N W X X X X
I
W X X
− −
=
−
∑∑
∑∑ ∑
∑
∑∑
∑∑
= 2
i
jiij
ij Z
ZZw
w
N
I
xxzxxz jjii −=−= ;
• Moran’s I statistic can take values between –1 and 1. Positive values of
Moran’s I indicate positive spatial autocorrelation in which similar values
are more likely than dissimilar values between neighbors and vice versa.
N = number of regions
Geary’s C
• Value typically range between 0 and 2
• If value of any one zone are spatially unrelated to any other zone, the
expected value of C will be 1
• Values less than 1 (between 1 and 2) indicate negative spatial
autocorrelation
• Inversely related to Moran’s I
• Does not provide identical inference because it emphasizes the
differences in values between pairs of observations, rather than the
covariation between the pairs.
• Moran’s I gives a more global indicator, whereas the Geary
coefficient is more sensitive to differences in small neighborhoods.
∑ ∑
∑ ∑
−
−−
=
i j iij
i j jiij
XXW
XXWN
C 2
2
)((2
])()[1[(
Expected Value and Variance
• Expected Value
• Variance
• Statistical Significance
E I
N
S
tr
M
N K
( ) =
−
V I
N
S
tr MWMW tr MW
N K N K E I
( ) .
. ' ( . )
( )( ) [ ( )]
=






+
− − + −
2 2
2
2
M I X X X= − −( ' ) '
Z I
I E I
V I
( )
( )
( )
=
−
Empirical Application (1)
• Basic Model
• Block Matrices
ititit XY εβ +=




























=
NT
N
N
T
Y
Y
Y
Y
Y
Y
Y



2
1
1
12
11




























=
NTNT
NN
NN
TT
XX
XX
XX
XX
XX
XX
X
21
2
2
2
1
1
2
1
1
1
2
1
1
12
2
12
1
11
2
11
1
1
1
1
1
1
1













=
2
1
0
β
β
β
β
Block Matrices
















































=










=










=
=
NNNN
N
N
NNNN
N
N
NNNN
N
N
www
www
www
N
Tt
www
www
www
N
t
www
www
www
N
t
W



















21
22221
11211
21
22221
11211
21
22221
11211
2
1
00
02
1
0
2
0002
1
1
Weight Matrix and Contiguity
Cell Locations and Values
a b c
d e f
g h i
9 6 3
8 5 2
7 4 1
  a b c d e f g h i Jmh
a 0 1 0 1 0 0 0 0 0 2
b 1 0 1 0 1 0 0 0 0 3
c 0 1 0 0 0 1 0 0 0 2
d 1 0 0 0 1 0 1 0 0 3
e 0 1 0 1 0 1 0 1 0 4
f 0 0 1 0 1 0 0 0 1 3
g 0 0 0 1 0 0 0 1 0 2
h 0 0 0 0 1 0 1 0 1 3
i 0 0 0 0 0 1 0 1 0 2
Jmh 2 3 2 3 4 3 2 3 2 24
Cij Matrix Based on Squared Euclidean Distance
  a b c d e f g h i
a 0 9 36 1 16 49 4 25 64
b 9 0 9 4 1 16 1 4 25
c 36 9 0 25 4 1 16 1 4
d 1 4 25 0 9 36 1 16 49
e 16 1 4 9 0 9 4 1 16
f 49 16 1 36 9 0 25 4 1
g 4 1 16 1 4 25 0 9 36
h 25 4 1 16 1 4 9 0 9
i 64 25 4 49 16 1 36 9 0
  a b c d e f g h i
a 0 9 0 1 0 0 0 0 0
b 9 0 9 0 1 0 0 0 0
c 0 9 0 0 0 1 0 0 0
d 1 0 0 0 9 0 1 0 0
e 0 1 0 9 0 9 0 1 0
f 0 0 1 0 9 0 0 0 1
g 0 0 0 1 0 0 0 9 0
h 0 0 0 0 1 0 9 0 9
i 0 0 0 0 0 1 0 9 0
(xi – xj)2
The WijCij Matrix for the General Cross Product
WijCij Matrix under Moran's I
  a b c d e f g h i Jmh
a 0 4 0 12 0 0 0 0 0 16
b 4 0 -2 0 0 0 0 0 0 2
c 0 -2 0 0 0 6 0 0 0 4
d 12 0 0 0 0 0 6 0 0 18
e 0 0 0 0 0 0 0 0 0 0
f 0 0 6 0 0 0 0 0 12 18
g 0 0 0 6 0 0 0 -2 0 4
h 0 0 0 0 0 0 -2 0 4 2
i 0 0 0 0 0 12 0 4 0 16
Jmh 16 2 4 18 0 18 4 2 16 80
Statistical Significance of Moran's
Latihan Spatial Statistics
75
85 50
80
85 85 70 60
90
82 65 50
88
A
B
C
E
D
G
J
I
H M
L
F K
Sebuah provinsi mempunyai  pola pendapatan per 
kapita sebagai tergambar dari peta hipotetikal berikut:
Pertanyaan:  
•Susunlah Contiguity Weight Matrix sebagai basis untuk menghitung Moran’s 
I
•Apa kesimpulan  Saudara, apakah pola pendapatan per kapita di provinsi 
tersebut menunjukkan pola yang sistematis? ( tak perlu uji signifikansi).

Ekreg ho-11-spatial ec 231112

  • 1.
    SPATIAL ECONOMETRICS PROGRAM PASCASARJANA ILMU EKONOMI UNIVERSITAS INDONESIA 23 Oktober 2012
  • 2.
    Ordinary Least Squares y= Xβ + ε y: Dependent variable (Land Price) X: independent (explanatory) variables (Center of CBD) β: regression coefficients ε: random error term • OLS estimates found by minimizing the sum of squared prediction errors. • Assumptions – error has mean zero – error terms are uncorrelated – error terms have a constant variance (homoskedastic) – error term follows a normal distribution, N(0, σ2). Asumsi dilanggar Dalam Model Regional /Spasial
  • 3.
    Spatial Dependence • Autocorrelationdoes not only occur in time series analysis, but also over space, where error terms in a spatial unit correlate with error terms in another spatial unit • The dependency of the error term over space is generally called spatial autocorrelation  Spatial Dependence • Occurred in applied empirical and in geographical analysis autocorrelation (Anselin and Rey, 1991; Anselin and Griffith, 1988; Siebert, 1975).
  • 4.
    When is thisan issue in regression analysis? • Lets say that you have multivariate spatial data and you are looking for relationships between the variables • You can use regression to find relationships as we have been doing so far in the course. However, if there is spatial autocorrelation in the residuals  your model is systematically overestimating the observed values in some regions, and underestimating the observed values in other regions  get unrealistic values for the significance and confidence limits for the coefficients • Why? Because, OLS assumes the cases are all independent. If there is correlation between them, they are not independent  your estimate of the number of degrees of freedom is too high, and your estimate of the standard errors will be too low  lead you to believe that some coefficients are significant, when in fact they are not.
  • 5.
    What is spatialautocorrelation? • First law of geography: “everything is related to everything else, but near things are more related than distant things” – Waldo Tobler • Spatial autocorrelation is said to exist when a variable exhibits a regular pattern over space in which its value at a set location depends on the values of the same variables at other locations (Odland, 1988:7) • What happens at one location is related to what happens at other locations (Gatrell, 1979). The value at any one point in space is dependent on values at the surrounding points. The arrangement of values is not just random • Dependency caused by: clusters, contiguity, externalities, interaction, spill- overs, heterogeneity • Positive spatial correlation means that similar values tend to be near each other. Negative spatial correlation means that different values tend to be near each other.
  • 6.
    Spatial Autocorrelation asmissing variables • Spatial autocorrelation arises as the manifestation of the missing variable problem, improper structural form, or measurement error problem • The absence of the analysis of spatial factors in the model makes it difficult to interpret the results of an Ordinary Least Square (OLS) model, making the t-test and an assessment of sampling variability unreliable • Ignoring the spatial error structure: • OLS is unbiased but inefficient, • standard errors and t-tests biased
  • 7.
    Regression diagnostics: Spatialautocorrelation • Observations from different locations for the error term are autocorrelated. • If spatial autocorrelation is ignored, then all inference (including t and F statistics, and R2) based on the standard regression model will be incorrect. • Moran’s I and Langrange multiplier (LM) tests – require normality of the error terms. • Robust Langrange multiplier test • does not require normality of the error terms • may not have much power for small data sets. • If normality is satisfied, use LM statistics for ‘error’ and ‘lag’.
  • 8.
    Pattern over Space:Similarity and Dissimilarity • Spatial autocorrelation is said to exist when a variable exhibits a regular pattern over space in which its value at a set location depends on the values of the same variables at other locations (Odland, 1988:7) • What happens at one location is related to what happens at other locations (Gatrell, 1979). The regular pattern can be one of similarity or dissimilarity. • Dependency caused by: clusters, contiguity, externalities, interaction, spill-overs, heterogeneity
  • 9.
    ML spatial lagmodel y = ρWy + Xβ + ε y : Dependent variable (eg. Harga Tanah) X : independent (explanatory) variables (Pusat Pertokoan, Perkantoran, dll Β : regression coefficients Ε : random error term ρ : Spatial autoregressive coefficient Wy : spatially lagged dependent variable
  • 10.
    ML spatial errormodel y = Xβ + ε, where ε = λWε + ξ Y : Dependent variable (Harga Tanah) X : independent (explanatory) variables (Pusat Pertokoan, CBD, dll. housing) Β : regression coefficients ε : random error term λ : autoregressive coefficient Wε: spatial lag for the errors ξ : normal distribution with mean 0 and variance σ2I ξγε 1 )( − −= WITotal effect:
  • 11.
    Measures of fit:R2 Measure the extent to which the predicted values match the observed values for the dependent variable •Calculated by R2 = 1 - RSS / SST •Model with highest R2 = best (subject to diagnostics) •Problem: increases with additional (explanatory) variables – overfitting – adjusted R2 •For spatial error model, use pseudo R2 because R2 is not applicable. Pseudo R2 = ratio of the variance of the predicted values over the variance of the observed values for the dependent variable
  • 12.
    Maximum likelihood (ML)estimates • ML estimates for the parameters = those values that obtain the highest probability or joint likelihood. • Based on the assumption of normal error terms. • Standard regression: OLS and ML estimates are the same to compare models of standard and spatial regression, use ML based measures of fit instead of R2. • Model with highest log likelihood = best (subject to diagnostics) • To deal with the problem of overfitting, use Akaike Information Criterion (AIC) • Model with lowest AIC = best (subject to diagnostics) • use Schwartz Criterion (SC), which is similar to AIC
  • 13.
    t-statistic For checking thesignificance of individual regression coefficients, β. •Estimate of β divided by its standard deviation, follows a t distribution with n (=no. Of observations - number of parameters estimated in the model) degrees of freedom. •Check probability, p, of the t-statistic if p<0.05, then β ≠ 0 at the 5% significance level. •For checking the significance of the regression specification, as a whole. •Check probability, p, of the F-statistic: – usually significant except for very poor model specification (in which case also indicated by R2).
  • 14.
    Example • Imagine ifyou had data from 10 counties spread all over the northeast. The data includes variables such as median income, # of highways, and access to the internet • You regress access to the internet (dependent variable) against the other two (independent) variables. You realize that n=10 is not enough to get significant results, so you need more data, get data from 10 additional counties, but you choose the counties that are immediately adjacent to the original 10 • If incomes and infrastructure hardly change from one county to the next, you are not really getting any additional information. This would be spatial autocorrelation • So how does this affect the regression results? You would be doing the calculations as if you had n=20 cases, but in reality you only had 10 independent cases. So, you would be overestimating the number of degrees of freedom, getting unrealistic t and p values, and underestimating the standard errors of the coefficients.
  • 15.
    Moran’s I • Oneof the oldest indicators of spatial autocorrelation (Moran, 1950). Still a defacto standard for determining spatial autocorrelation • Applied to zones or points with continuous variables associated with them. • Compares the value of the variable at any one location with the value at all other locations , 2 , ( )( ) ( ) ( ) i j i ji j i j ii j i N W X X X X I W X X − − = − ∑∑ ∑∑ ∑ ∑ ∑∑ ∑∑ = 2 i jiij ij Z ZZw w N I xxzxxz jjii −=−= ; • Moran’s I statistic can take values between –1 and 1. Positive values of Moran’s I indicate positive spatial autocorrelation in which similar values are more likely than dissimilar values between neighbors and vice versa. N = number of regions
  • 16.
    Geary’s C • Valuetypically range between 0 and 2 • If value of any one zone are spatially unrelated to any other zone, the expected value of C will be 1 • Values less than 1 (between 1 and 2) indicate negative spatial autocorrelation • Inversely related to Moran’s I • Does not provide identical inference because it emphasizes the differences in values between pairs of observations, rather than the covariation between the pairs. • Moran’s I gives a more global indicator, whereas the Geary coefficient is more sensitive to differences in small neighborhoods. ∑ ∑ ∑ ∑ − −− = i j iij i j jiij XXW XXWN C 2 2 )((2 ])()[1[(
  • 17.
    Expected Value andVariance • Expected Value • Variance • Statistical Significance E I N S tr M N K ( ) = − V I N S tr MWMW tr MW N K N K E I ( ) . . ' ( . ) ( )( ) [ ( )] =       + − − + − 2 2 2 2 M I X X X= − −( ' ) ' Z I I E I V I ( ) ( ) ( ) = −
  • 18.
    Empirical Application (1) •Basic Model • Block Matrices ititit XY εβ +=                             = NT N N T Y Y Y Y Y Y Y    2 1 1 12 11                             = NTNT NN NN TT XX XX XX XX XX XX X 21 2 2 2 1 1 2 1 1 1 2 1 1 12 2 12 1 11 2 11 1 1 1 1 1 1 1              = 2 1 0 β β β β
  • 19.
  • 20.
  • 21.
    Cell Locations andValues a b c d e f g h i 9 6 3 8 5 2 7 4 1   a b c d e f g h i Jmh a 0 1 0 1 0 0 0 0 0 2 b 1 0 1 0 1 0 0 0 0 3 c 0 1 0 0 0 1 0 0 0 2 d 1 0 0 0 1 0 1 0 0 3 e 0 1 0 1 0 1 0 1 0 4 f 0 0 1 0 1 0 0 0 1 3 g 0 0 0 1 0 0 0 1 0 2 h 0 0 0 0 1 0 1 0 1 3 i 0 0 0 0 0 1 0 1 0 2 Jmh 2 3 2 3 4 3 2 3 2 24
  • 22.
    Cij Matrix Basedon Squared Euclidean Distance   a b c d e f g h i a 0 9 36 1 16 49 4 25 64 b 9 0 9 4 1 16 1 4 25 c 36 9 0 25 4 1 16 1 4 d 1 4 25 0 9 36 1 16 49 e 16 1 4 9 0 9 4 1 16 f 49 16 1 36 9 0 25 4 1 g 4 1 16 1 4 25 0 9 36 h 25 4 1 16 1 4 9 0 9 i 64 25 4 49 16 1 36 9 0   a b c d e f g h i a 0 9 0 1 0 0 0 0 0 b 9 0 9 0 1 0 0 0 0 c 0 9 0 0 0 1 0 0 0 d 1 0 0 0 9 0 1 0 0 e 0 1 0 9 0 9 0 1 0 f 0 0 1 0 9 0 0 0 1 g 0 0 0 1 0 0 0 9 0 h 0 0 0 0 1 0 9 0 9 i 0 0 0 0 0 1 0 9 0 (xi – xj)2 The WijCij Matrix for the General Cross Product
  • 23.
    WijCij Matrix underMoran's I   a b c d e f g h i Jmh a 0 4 0 12 0 0 0 0 0 16 b 4 0 -2 0 0 0 0 0 0 2 c 0 -2 0 0 0 6 0 0 0 4 d 12 0 0 0 0 0 6 0 0 18 e 0 0 0 0 0 0 0 0 0 0 f 0 0 6 0 0 0 0 0 12 18 g 0 0 0 6 0 0 0 -2 0 4 h 0 0 0 0 0 0 -2 0 4 2 i 0 0 0 0 0 12 0 4 0 16 Jmh 16 2 4 18 0 18 4 2 16 80
  • 24.
  • 25.
    Latihan Spatial Statistics 75 8550 80 85 85 70 60 90 82 65 50 88 A B C E D G J I H M L F K Sebuah provinsi mempunyai  pola pendapatan per  kapita sebagai tergambar dari peta hipotetikal berikut: Pertanyaan:   •Susunlah Contiguity Weight Matrix sebagai basis untuk menghitung Moran’s  I •Apa kesimpulan  Saudara, apakah pola pendapatan per kapita di provinsi  tersebut menunjukkan pola yang sistematis? ( tak perlu uji signifikansi).