Oxford University Press - Online Resource Centres

Lloyd: Spatial Data Analysis

Worked examples

This section includes worked examples from the book, along with guidance on how to replicate the examples.

Download a zip file containing all the worked example files.

Section 4.7 - Geographical weights

The file gwbwIDW.xls contains columns headed ‘No’, ‘Distance’, ‘Value’, ‘Weight’ and ‘ValuexWt’. ‘Distance’ is distance from an unsampled location, ‘Value’ is an observation and ‘Weight’ is the inverse distance weight. ‘ValuexWt’ is the value multiplied by the geographical weight. The values, weights and weighted values are summed in the penultimate row. In the final row, the mean and geographically weighted means for the different exponents (powers) are given. The effect of altering the IDW exponent can be explored by changing one of the exponent values.

Section 4.8 - Spatial dependence and spatial autocorrelation

In the file Moran_cell.xls, calculations for global Moran’s I are given. The values are the same as those given in Tables 4.3 and 4.4 in the book. Note that the first column ‘Adj’ indicates the number of the adjacency. For example, the value seven has the value eight as a neighbour – they are adjacent. The value seven also has the value nine as a neighbour; this is the second listed adjacency. In all there are 40 such adjacencies. ‘Nneighbours’ indicates the number of neighbours of each cell (for example, the cell with a value of seven has three neighbours.

Section 8.4 - Local univariate measures

The file gwbwGauss.xls, like the previous file, contains columns headed ‘No’, ‘Distance’ (from the first location listed), ‘Value’, ‘Weight’ and ‘ValuexWt’. In this case, ‘Weight’ is the geographical weight obtained using the Gaussian weighting function. Results are given for bandwidths (‘BW’) of 5, 10, 15 and 20 units. The effect of altering the bandwidth of the geographically weighted mean can be explored by changing one of the bandwidth values.

Section 8.5.3 - Geographically weighted regression

The file gwr.xls contains columns headed ‘Variable 1’, ‘Variable 2’, ‘Distance’, ‘Geog. Wt.’, ‘Unwtd pred’ and ‘GW pred’. ‘Distance’ is distance from the first variable and ‘Geog. Wt.’ is the geographical weight obtained using the Gaussian weighting function. ‘Unwtd pred’ are unweighted regression predictions and ‘GW pred’ are geographically weighted regression predictions.

Section 9.5 - Inverse distance weighting

The file idw.xls gives five sets of precipitation amount values. The distances from the first ‘true value’ (which is assumed unknown) are given, as are the inverse square distances (ISD) and values multiplied by the ISDs. The IDW prediction is given by the sum of the values multiplied by the ISD weights divided by the sum of the weights (that is, the ISD values).