Maps and Basic Statistics

Visualizing spatial data: Maps

Maps offer rich possibilities of visualizing spatial data. At the moment this section is about simple choropleth maps only.

spmap some-variable using my-coord , id(id-var) fcolor(Blues)

This will draw a choropleth map of variable some-variable (which is a column of your database file; this file is the current working file) using the coordinates file my-coord (with id variable id-var). Several shades of blue are used to characterize different degress of some-variable.

Unsurprisingly, there is a plethora of options available for finetuning the map according to your wishes.


Statistics for spatial autocorrelation

There are global and local statistics. The most common is Moran's I (with both a global and a local version), but some other statistics may be computed as well.

spatgsa some-variable, weights(w-matrix) moran

will compute Moran's (global) I for variable some-variable. The variable is part of the (spatial) database file (which is supposed to be your current working, or master, file), and the computation uses weight matrix w-matrix created by spatwmat.

No statistics will be computed if there is any missing value in the variable under investigation (without any reason given!). Regrettably, if does not work with spatgsa (or with the command presented next, spatlsa.

spatlsa some-variable, weights(w-matrix) moran id(id-var)

will compute Moran's (Local) I for variable some-variable. The variable is part of the (spatial) database file (which is supposed to be your current working, or master, file), and the computation uses weight matrix w-matrix created by spatwmat. Variable id-var (which uniquely characterizes the observation) is used for identification of observations in the output.

Option moran restricts the output to Moran's I. See the help function for other statistics (or just omit this option, in which case you will get several statistics). Note that no statistics are computed if there are missing values in some-variable.

© W. Ludwig-Mayerhofer, Stata Guide | Last update: 18 Aug 2016