![Page 1: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/1.jpg)
Stata in Space:Stata in Space:An example for the econometric An example for the econometric
analysis of spatially explicit raster dataanalysis of spatially explicit raster data
--- Daniel Müller ---
Institute of Agricultural Economics and Social Sciences
Humboldt University Berlin
Berlin -- August, 12th, 2003
![Page 2: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/2.jpg)
Outline
1. Introduction
2. Spatial data analysis
3. Data preparation
4. The empirical example
5. Econometric estimation
6. Export of results and geovisualization
![Page 3: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/3.jpg)
Introduction- Socioeconomic data usually exist for (discrete)
social entities, rarely explicitly linked to location (georeferenced)
- ‘Natural’ data: often continuous (rainfall, slope, elevation) and georeferenced
- Integration of both data sources can provide additional insights
- Allows to understand spatial patterns & processes- Knowing the where can help us infer the why
![Page 4: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/4.jpg)
Spatial data analysis- Spatial analysis is the analysis of data linked to
location (spatial data)
- Why analysis of spatial data ?- Variables of interest vary in space- Location matters!
- Spatial analysis can provide important insights:- geographical targeting of investments- diffusion of technologies- causes and consequences of land-use change
![Page 5: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/5.jpg)
What’s special about spatial data ?
=> Location matters !!!
=> Tobler’s 1st law of geography (1979):
“Everything is related to everything else, but near things are more related than distant things.”
=> Spatial effects:- spatial autocorrelation
- spatial heterogeneity
Spatial data analysis
![Page 6: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/6.jpg)
Spatial data analysisPeculiarities in space: Spatial effects
1. Spatial autocorrelation
- Coincidence of value similarity with locational similarity
- Second dimension adds mathematical complexity (multiple directions)
2. Spatial heterogeneity
- Each location is unique
- Units of observations not homogeneous across space
- Structural instability over space, e.g. heteroskedasticity
![Page 7: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/7.jpg)
Spatial data analysisPeculiarities in space: spatial effects [2]
Spatial effects due to:- interactions among neighboring agents- data from different sources- different sample designs- varying aggregation rules
“Spatial relationships among observations can result in unreliable estimates and misguided statistical inference of the parameters.” (Anselin 1988).
=> Corrections necessary
![Page 8: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/8.jpg)
Spatial data analysis
Geographic Information Systems (GIS):
- Compile, store, manipulate, analyse, visualize spatial data
- Consist of hardware, software, data and procedures
- Data models: vector & raster
![Page 9: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/9.jpg)
Spatial data analysis
Raster data model:- Arrangement of regularly shaped, contiguous cells
- Continuous data layers; fit together edge-to-edge
- Typically consist of square cells
- Each cell represents a location in a raster GIS
- Cells are arranged in layers
- Values of a cell indicate characteristics of that location
- Data is composed of many layers covering the same geographical area
![Page 10: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/10.jpg)
Spatial data analysis
Raster data model --- file structure:
1 1 2 2 2
3 1 3 2 1
2 3 3 4 2
3 5 5 6 6
6 6 4 4 6
Header: Contains spatial information!
![Page 11: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/11.jpg)
Spatial data analysisRaster data model --- land use map:
![Page 12: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/12.jpg)
Spatial data analysisFrom data layers to resulting map
overlaysdata layers analyses output
![Page 13: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/13.jpg)
Data preparationImporting grids into Stata
ras2dta , files(filelist) [ idcell(varname) nodata(#) dropmiss
xcoord(#) ycoord(#) genxcoor(varname) genycoor(varname)
header(filename) saving(filelist) replace clear ]
→ infile-s grids (filelist) into Stata:
→ -generate-s IDcode for each cell (=observation)
→ reads the information from the header (if present)
→ “ sets missing values to a specified number
→ “ -drop-s unnecessary empty cells
→ “ -generate-s X and Y coordinates
→ “ -save-s the header information in a file
![Page 14: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/14.jpg)
Data preparation
Integration of data layers
1. Import of raster grids (-ras2dta-)
2. Combination of raster layers in Stata (-joinby-, -merge-) based on spatial identifier (ID-code of cells)
3. Socioeconomic (survey, census) data can be joined to grids based on, e.g., administrative boundaries
![Page 15: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/15.jpg)
Data preparation
Corrections of spatial effects
1. Spatial lag variables with index values for latitude (Y) and longitude (X)
2. Spatially lagged variables
3. Regular sampling from a grid
=> 1. can be done with -ras2dta-
=> 2. we ignore here
=> 3. is easy in Stata, e.g. with : -spatsam-
![Page 16: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/16.jpg)
Data preparation
spatsam , gap(#) xcoord(varname) ycoord(varname) [ saving(filename) norestore
noseed replace ]
Basically that‘s:
keep if (xcoord / gap) == int (xcoord / gap) &
(ycoord / gap) == int (ycoord / gap)
Therefore, only every #-th observation in X and
Y direction is kept in the sample.
![Page 17: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/17.jpg)
The empirical example
Land use change in Vietnam- Land use as an inherently spatial process
- Returns to land use are (spatially) affected by:- market accessibility (von Thünen)- land rent (Ricardo)
- Possible factors to consider:
- soil quality, topography, climate, market locations, population density, technology
- Limited dependent variable problem (-mlogit-)
![Page 18: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/18.jpg)
Data- Satellite image interpretation:
- land cover => land use (change)
- GIS, maps, point measurements:- geophysical indicators => topography, soil, climate
- Socioeconomic & policy variables:- village survey, secondary statistics
=> technology, population, education, market access
- Data integration based on spatial identifier and (approximated) village areas
The empirical example
![Page 19: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/19.jpg)
Observations: 964,000 pixels (50 x 50 m)
Spatial sample: every 5. cell in X & Y direction
Estimation: 35,000 observations
=> Dependent: five land cover classes (1, 2, .., 5)
=> Independent: a) geophysical
b) socioeconomic
c) policy
d) spatial effects
Econometric estimation
![Page 20: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/20.jpg)
Econometric estimation
1. Estimation of the influence of hypothesized determinants on land use.
2. What is the probability that a certain pixel falls into one of the five land-use categories?
=> -mlogit- (reduced form, clustered for villages)
=> -mlogtest, iia-, -fitstat- (Long & Freese)
Then we take the highest predicted probability as predicted land use.
![Page 21: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/21.jpg)
Outputting results from Stata
dta2ras [varlist], xcoord(#) ycoord(#) cellsize(#) [
header(filename) idcell(varname) nodata(#)
xllcorner(#) yllcorner(#) saving(varlist) replace ]
→ writes header in front of file with the information from xcoord(#) ycoord(#) cellsize(#) or
header(); (optionally) nodata(#) xllcorner(#) yllcorner(#)
→ then the results can be mapped in the GIS
Export of results
![Page 22: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/22.jpg)
Geovisualization of resultsPrediction map
![Page 23: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/23.jpg)
Geovisualization of resultsMaximum predicted probabilities
![Page 24: Stata in Space: An example for the econometric analysis of spatially explicit raster data --- Daniel Müller --- Institute of Agricultural Economics and](https://reader036.vdocument.in/reader036/viewer/2022062421/56649cf15503460f949c08bc/html5/thumbnails/24.jpg)
Thank you !
Questions, comments and critique welcome ! ____________________________
© Daniel Müller ([email protected])
Institute of Agricultural Economics and Social Sciences---- Humboldt University Berlin ----
Stata ados available for download at:
http://amor.cms.hu-berlin.de/~muelleda