Chapter 7 Spatial Attribute Analysis With R

7.1 Introduction

7.3 A Visual Exploration of Autocorrelation

Randomisation of smoking uptake rates

Figure 7.2: Randomisation of smoking uptake rates

[1] 5

7.3.1 Neighbours and Lagged Mean Plots

Neighbour list object:
Number of regions: 67 
Number of nonzero links: 346 
Percentage nonzero weights: 7.70773 
Average number of links: 5.164179 
Depiction of Neighbouring Counties of Penn State as a network (Queen's case.)

Figure 7.3: Depiction of Neighbouring Counties of Penn State as a network (Queen’s case.)

Comparison of Neighbouring Counties of Penn State (Rook's vs. Queen's case).

Figure 7.4: Comparison of Neighbouring Counties of Penn State (Rook’s vs. Queen’s case).

Characteristics of weights list object:
Neighbour list object:
Number of regions: 67 
Number of nonzero links: 330 
Percentage nonzero weights: 7.351303 
Average number of links: 4.925373 

Weights style: W 
Weights constants summary:
   n   nn S0       S1       S2
W 67 4489 67 28.73789 274.6157
Lagged means of smoking uptake rates

Figure 7.5: Lagged means of smoking uptake rates

Lagged Mean plot for smoking uptake

Figure 7.6: Lagged Mean plot for smoking uptake

Lagged Mean plot for smoking uptake - alternative method.

Figure 7.7: Lagged Mean plot for smoking uptake - alternative method.

7.4 Moran’S I: An Index Of Autocorrelation

7.4.1 Moran’s-\(I\) in R


    Moran I test under randomisation

data:  penn.state.utm$smk  
weights: penn.state.lw    

Moran I statistic standard deviate = 5.4175, p-value
= 3.022e-08
alternative hypothesis: greater
sample estimates:
Moran I statistic       Expectation          Variance 
      0.404431265      -0.015151515       0.005998405 
[1] -0.5785577  1.0202308

    Moran I test under normality

data:  penn.state.utm$smk  
weights: penn.state.lw    

Moran I statistic standard deviate = 5.4492, p-value
= 2.53e-08
alternative hypothesis: greater
sample estimates:
Moran I statistic       Expectation          Variance 
      0.404431265      -0.015151515       0.005928887 

7.4.2 A Simulation-Based Approach


    Monte-Carlo simulation of Moran I

data:  penn.state.utm$smk 
weights: penn.state.lw  
number of simulations + 1: 10001 

statistic = 0.40443, observed rank = 10001, p-value =
9.999e-05
alternative hypothesis: greater

note that the third argument provides the number of simulations. Once again, there is evidence to reject the null hypothesis that any permutation of \(z_i\)’s is equally likely in favour of the alternative that \(I > 0\).

7.4.3 Spatial Autoregression

7.5 Calibrating Spatial Regression Models in R


Call:
spautolm(formula = smk ~ 1, data = penn.state.utm, listw = penn.state.lw)

Coefficients:
(Intercept)      lambda 
 23.7689073   0.6179367 

Log likelihood: -142.8993 
[1] 0.1130417
[1] 0.3918532 0.8440201

7.5.1 Models with predictors: A Bivariate Example

  county cases population race gender      age
1  adams     0       1492    o      f Under.40
2  adams     0        365    o      f    40.59
3  adams     1         68    o      f    60.69
4  adams     0         73    o      f      70+
5  adams     0      23351    w      f Under.40
6  adams     5      12136    w      f    40.59
     county cases population
1     adams    55      91292
2 allegheny  1275    1281666
3 armstrong    49      72392
4    beaver   172     181412
5   bedford    37      49984
6     berks   308     373638
     county cases population     rate
1     adams    55      91292 6.024624
2 allegheny  1275    1281666 9.947990
3 armstrong    49      72392 6.768704
4    beaver   172     181412 9.481181
5   bedford    37      49984 7.402369
6     berks   308     373638 8.243273
Boxplot of Cancer Rates (Penn State 2002)

Figure 7.8: Boxplot of Cancer Rates (Penn State 2002)


Call: 
spautolm(formula = rate ~ sqrt(penn.state.utm$smk), data = totcases, 
    listw = penn.state.lw, weights = population)

Residuals:
     Min       1Q   Median       3Q      Max 
-5.45183 -1.10235 -0.31549  0.59901  5.00115 

Coefficients: 
                         Estimate Std. Error z value
(Intercept)              -0.35263    2.26795 -0.1555
sqrt(penn.state.utm$smk)  1.80976    0.46064  3.9288
                          Pr(>|z|)
(Intercept)                 0.8764
sqrt(penn.state.utm$smk) 8.537e-05

Lambda: 0.38063 LR test value: 6.3123 p-value: 0.01199 
Numerical Hessian standard error of lambda: 0.13984 

Log likelihood: -123.3056 
ML residual variance (sigma squared): 209030, (sigma: 457.19)
Number of observations: 67 
Number of parameters estimated: 4 
AIC: 254.61

7.5.2 Further Issues

7.5.3 Troubleshooting Spatial Regression

Shapefile of neighbourhoods in Columbus, Ohio, with labels

Figure 7.9: Shapefile of neighbourhoods in Columbus, Ohio, with labels

Neighbour list object:
Number of regions: 49 
Number of nonzero links: 236 
Percentage nonzero weights: 9.829238 
Average number of links: 4.816327 
Neighbour list object:
Number of regions: 49 
Number of nonzero links: 200 
Percentage nonzero weights: 8.329863 
Average number of links: 4.081633 
Relationship between $\lambda$ and the correlation between zones 41 and 47

Figure 7.10: Relationship between \(\lambda\) and the correlation between zones 41 and 47

Relationship between $\lambda$ and the correlation between zones 41 and 47

Figure 7.11: Relationship between \(\lambda\) and the correlation between zones 41 and 47

Parametric plot of correlations between two polygon pairs (40,41) and (41,47)

Figure 7.12: Parametric plot of correlations between two polygon pairs (40,41) and (41,47)

Parametric Plots of 100 Sampled Correlations

Figure 7.13: Parametric Plots of 100 Sampled Correlations

Answer to self-test question

Bootstrap Randomisation of smoking uptake rates

Figure 7.14: Bootstrap Randomisation of smoking uptake rates