38

Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial EconometricsLecture 1 The notion of spatial modelling Visualisation of

spatial data in R

Andrzej Toroacutej

Institute of Econometrics Department of Applied Econometrics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 1 30

Why spatial modelling Spatial data structure Software and data

Contents

1 Why spatial modelling

Space vs ties between units

Applications of spatial modelling

2 Spatial data structure

Spatial order vs temporal order

Types of spatial inuences

3 Software and data

Software

Sources of spatial data and literature

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 2 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 3 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 2: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Contents

1 Why spatial modelling

Space vs ties between units

Applications of spatial modelling

2 Spatial data structure

Spatial order vs temporal order

Types of spatial inuences

3 Software and data

Software

Sources of spatial data and literature

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 2 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 3 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 3: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 3 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 4: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 5: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 6: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Paradigms

Toblers law (1970) Everything is related to everything else

but near things are more related than distant things

Toblers second law (2004) The word near may have a lot

of meanings

In other words Beck (2006) There is more to space than

geography

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 4 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 7: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 1 neighbourhood ties between counties in USA

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 5 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 8: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Case 2 following tweets among French members ofparliament

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 6 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 9: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

How are spatial ties generated

Units impact on one anothereg spatial diusion cases of u in a given district

But also

Level of measurement not suitable for the investigatedphenomenon (np regional aggregates instead of micro-data)Common measurement errors (eg community-level dataprepared under dierent guidelines of regional statisticaloces)Spatial aggregation level

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 7 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 10: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (1)

On average 0 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 8 30

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 11: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Space vs ties between units

Spatial aggregation level (2)

On average 267 neighbours of the same colourAndrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 9 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 12: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 13: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 14: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (1)

Applications

traditional maps of ties between states or regions eg intrade or foreign investmentregional analyses ties between relatively small units (poviatscommunities) observable via eg unemployment rates or localgovernment nancebusiness analyses big data from GIS systems (eg modellingthe attractiveness of business locations optimisation of salesnetwork managing logistics)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 10 30

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 15: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Applications of spatial modelling

Applications of spatial modelling (2)

security policy (alliances wars military interventions)

protection of environment (air pollution water contagion)

international interdependence of policies (copying legislation

patterns)

political science (constituencies and electoral systems)

epidemiology (spreading of epidemics)

economic diusion (local labour markets)

More Haegerstrand (1967) Manski (2000) Simmons et al(2005)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 11 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 16: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 12 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 17: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Temporal order

For time series we use the notion of serial correlation It

makes sense when

observations are aligned in a linear order (1-D)the frequency of the series is set ie identically long reportingperiods (or intervals between measurement moments)

Source of information about the order the records are

sorted or there is an explicit timestamp

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 13 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 18: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Spatial order

The temporal 1-D order is not the only possible one for our

data

observations may be attributed to areas or points on a surfaceor sphere (2-D)implications of such an order are more dicult to manage (2-Drather than 1-D) but ignoring this may lead to the sameproblems as temporal serial correlation

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 14 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 19: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 20: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 21: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 22: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Source of information about the spatial order

In spatial econometrics the order is described by a spatial weight

matrix (see next lecture) It might be based on

manual imputation of neighbourhood relationships (tedious)

eg USA linked to Mexico Canada linked to USA Mexico notlinked to Canada

distance matrix between units in space

how to generate ithow exactly to measure the distance

graphical 2-D representation of space ie a map from which

neighbourhood relationships or distances can be derived

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 15 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 23: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 24: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Spatial order vs temporal order

Econometric implications of spatial linkages

Observations are not independent

In this model yi = β0 + β1xi + εi it is not any more true thatεi sim i i d (independent identically distributed)The consequence is at best ineciency of OLS estimation(like in the case of temporal autocorrelation)

The big dierence while the temporal impact runs in onedirection only (past rarr present) spatial autocorrelation canrun in both directions (our region larrrarr neighbourhoodregion larrrarr other regions larrrarr our region)

Here the implications can be more serious and involveinconsistency and bias in OLS estimation (like in simultaneousequations models)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 16 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 25: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences

will be presented by world-class experts in neighbourhood topics

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 17 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 26: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (1)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 18 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 27: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (2)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 19 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 28: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (3)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 20 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 29: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Main types of spatial inuences (4)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 21 30

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 30: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Types of spatial inuences

Types of spatial inuences additional remarks

Hasty conclusions of spatial interdependence should be avoided

(situation 3) unless other cases have reasonably been

excluded

Spatial interdepencence (situation 3) is relatively unlikely when

modelling spatial aggregates Situations 1 and 2 more likely in

that case

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 22 30

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 31: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Plan prezentacji

1 Why spatial modelling

2 Spatial data structure

3 Software and data

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 23 30

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 32: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Software

Software

A small number of econometric packages oers tools for spatial

modelling The leading ones Matlab Stata R The materials

accompanying this lecture use R (via RStudio)

Installing package spdep

installpackages(spdep)

library(spdep)

Another useful package is rgdal and for visualising data on map

additionally maptools RColorBrewer i classInt

Lista wszystkich pakietoacutew R do analizy danych przestrzennych na

CRAN

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 24 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 33: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example

Our task is to plot a map illustrating the unemployment rate from

the le BDL_danexls for poviats This sample covers Poland in

2014 and comes from Local Data Bank by GUS (Central

Statistical Oce in Poland)

To do this we must merge the unemployment data with

cartographic data

This is how we impose a spatial structure on the data

Will also be useful in modelling in the following lectures

Solution with comments in the accompanying R code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 25 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 34: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Example nal eect of the code

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 26 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 35: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Sources of cartographic data

GADM administrative divisions in almost all countries of the world

CODGiK more accurate maps by Polish Centralny Oplusmnrodek Dokumentacji

Geodezyjnej i Kartogracznej (surveyor authority)

Eurostat maps of EU states in NUTS nomenclature from NUTS0 toNUTS3 (in Poland NUTS2 voivodships NUTS4 poviats)

package cshapes in R ready-made world map (current and historicalafter 1945) with additional functions for international spatial analyses

and many more

Optimization of map size

Map les are usually ver precise taking many MB of disc space

One can decrease this size - often without any detriment to the

illustration quality - using converters (eg mapshaperorg)

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 27 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 36: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Functions in use

readOGR imports the map and uses the following les

shp shapes of the regionsadditionally shx (auxiliary indexing le) and dbf

(accompanying database)prj technical details related to the projection of geosphere onthe plane

spTransform allows to transform all the geocoding

information into longitude and latitude in degrees (required by

a number of R packages)

colorRampPalette useful to transform the visualised

(continuous) variable into colours

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 28 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 37: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Homework 1Using the Eurostat database and R please illustrate the regional variation in a selected variable in aEuropean country of Your choice and a chosen time period (this should not be the unemployment ratenor Poland but still a relatively large country)

One can use an own alternative data source The map should consist of 25-30 regions Theillustrated variable will be the dependend variable in the model prepared in subsequenthomeworks so one should be able to nd further variables for the same set of regions (to beused as sensible regressors)

The uploaded PDF le should contain a short descritption of the analysed variable data sourceand map source indication and the illustration (map) itself max 1 page

The uploaded ZIP le should contain the whole replication package data le R code andpossibly map les (if these are the same les as the ones used in the class this can be skipped ifthese are dierent les but prohibitively big ie making the upload size exceed the 5 MB limitplease put only a txt le with URL codes of every of the map les (or a ZIP package) on theuploaded archive This remark is related to all future homeworks

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 29 30

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data
Page 38: Spatial Econometricsweb.sgh.waw.pl/~atoroj/ekonometria_przestrzenna/1... · Source of information about the spatial order In spatial econometrics, the order is described by a spatial

Why spatial modelling Spatial data structure Software and data

Sources of spatial data and literature

Literature

Compulsory

Arbia G A Primer for Spatial Econometrics with Applications inR 2014 Palgrave Macmillan

Other

Anselin L Spatial Econometrics ch 29 in TC Mills and KPatterson (Eds) Palgrave Handbook of Econometrics Volume 1Econometric Theory Basingstoke Palgrave Macmillan 2006 pp901-969

Le Sage J and Pace RK Introduction to Spatial Econometrics2009 Chapman and HallCRC

Andrzej Toroacutej Institute of Econometrics Department of Applied Econometrics

(1) Spatial Econometrics 30 30

  • Why spatial modelling
  • Spatial data structure
  • Software and data