The missing link is between Clare and Kerry, perhaps by the
Tarbert–Killimer ferry, but the counties are not contiguous, as Figure
-
-shows:
+
res$length <- res$length*1000
attr(res, "external") <- attr(res, "external")*1000
@@ -514,20 +503,19 @@ Measures of spatial autocorrelation
## n nn S0 S1 S2
## W 25 625 25 15.84089 103.6197
The standard representation of the measures is:
-
-
for Moran’s
-
-— in the paper termed the proposed statistic, and for Geary’s
-:
-
-
where
-
-are
-
-observations on the numeric variable of interest, and
-
+
\[I =
+\frac{n}{\sum_{i=1}^{n}\sum_{j=1}^{n}w_{ij}}
+\frac{\sum_{i=1}^{n}\sum_{j=1}^{n}w_{ij}(x_i-\bar{x})(x_j-\bar{x})}{\sum_{i=1}^{n}(x_i
+- \bar{x})^2}\]
+
for Moran’s \(I\) — in the paper
+termed the proposed statistic, and for Geary’s \(C\):
+
\[C =
+\frac{(n-1)}{2\sum_{i=1}^{n}\sum_{j=1}^{n}w_{ij}}
+\frac{\sum_{i=1}^{n}\sum_{j=1}^{n}w_{ij}(x_i-x_j)^2}{\sum_{i=1}^{n}(x_i
+- \bar{x})^2}\]
+
where \(x_i, i=1, \ldots, n\) are
+\(n\) observations on the numeric
+variable of interest, and \(w_{ij}\)
are the spatial weights. In order to reproduce the standard deviates
given in the paper, it is sufficient to apply
moran.test
to the variables with three
@@ -548,7 +536,7 @@
Measures of spatial autocorrelation
Prop_stdR <- lapply(vars, function(x) moran.test(eire_ge1[[x]], listw=lw_std, randomisation=TRUE))
})
res <- sapply(c("MoranN", "MoranR", "GearyN", "GearyR", "Prop_unstdN", "Prop_unstdR", "Prop_stdN", "Prop_stdR"), function(x) sapply(get(x), "[[", "statistic"))
rownames(res) <- vars
@@ -626,17 +614,14 @@ Measures of spatial autocorrelation
## retailpcap 0.3734 0.1202 0.5267 0.1413 0.3959 0.1515 0.4066 0.1498
## psinglem30_34 0.2828 0.1207 0.6465 0.1385 0.3697 0.1520 0.3583 0.1503
The values are as follows, and match the original with the exception
-of those for the initial version of Moran’s
-
-in the first two columns. If we write a function implementing equations
-3 and 4:
-
-
where crucially the inner summation is over
-,
-not
-, we can reproduce the values of the
-measure shown in the original Table 5:
+of those for the initial version of Moran’s
\(I\) in the first two columns. If we write a
+function implementing equations 3 and 4:
+
\[I =
+\frac{\sum_{i=1}^{n}\sum_{j=i+1}^{n}w_{ij}(x_i-\bar{x})(x_j-\bar{x})}{\sum_{i=1}^{n}(x_i
+- \bar{x})^2}\]
+
where crucially the inner summation is over \(i+1 \ldots n\), not \(1 \ldots
+n\), we can reproduce the values of the measure shown in the
+original Table 5:
oMoranf <- function(x, nb) {
z <- scale(x, scale=FALSE)
@@ -703,9 +688,8 @@ Simulating measures of s
nsim <- 4999
set.seed(1234)
First let us define a function MoranI.boot
-just to return the value of Moran’s
-
-for variable var
and permutation index
+just to return the value of Moran’s \(I\) for variable
+var
and permutation index
i
, and a function
Nsim
to generate random samples from the
variable of interest assuming Normality. To make it easier to process
@@ -733,12 +717,11 @@
Simulating measures of s
deviates under Normality and randomisation, and see that in fact the
differences are not at all large, as expressed by the median absolute
difference between the tables. We can also see that inferences based on
-a one-sided
-
-cut-off are the same for the analytical and bootstrap approaches. This
-indicates that we can, in general, rely on the analytical standard
-deviates, and that bootstrap methods will not help if assumptions
-underlying the measures are not met.
+a one-sided \(\alpha=0.05\) cut-off are
+the same for the analytical and bootstrap approaches. This indicates
+that we can, in general, rely on the analytical standard deviates, and
+that bootstrap methods will not help if assumptions underlying the
+measures are not met.
## pagval2_10 ln_pagval2_10 pagval10_50 pagval50p cowspacre ln_cowspacre
@@ -761,17 +744,12 @@ Simulating measures of s
find an equivalent to the analytical or bootstrap-based standard deviate
for inference (Tiefelsdorf 2002). The
Saddlepoint approximation requires the eigenvalues of the weights matrix
-and iterative root-finding for global Moran’s
-,
-while for local Moran’s
-,
-analytical forms are known. Even with this computational burden, the
-Saddlepoint approximation for global Moran’s
-
-runs quite quickly. First we need to fit null linear models (only
-including an intercept) to the variables, then apply
-lm.morantest.sad
to the fitted model
-objects:
+and iterative root-finding for global Moran’s \(I\), while for local Moran’s \(I_i\), analytical forms are known. Even
+with this computational burden, the Saddlepoint approximation for global
+Moran’s \(I\) runs quite quickly. First
+we need to fit null linear models (only including an intercept) to the
+variables, then apply lm.morantest.sad
to the
+fitted model objects:
## user system elapsed
-## 0.090 0.000 0.091
+## 0.05 0.02 0.08
res <- sapply(c("MoranSad", "Prop_unstdSad", "Prop_stdSad"), function(x) sapply(get(x), "[[", "statistic"))
rownames(res) <- vars
@@ -788,19 +766,11 @@ Simulating measures of s
larger than those reached using the Saddlepoint approximation when
measured by median absolute deviation, the differences do not lead to
different inferences at this chosen cut-off. This reflects the fact that
-the shape of the distribution is very sensitive to small
-,
-but for moderate
-
-and global Moran’s
-,
-the effects are seen only further out in the tails. The consequences for
-local Moran’s
-
-are much stronger, because the clique of neighbours of each observation
-is typically very small. It is perhaps of interest that the differences
-are much smaller for the case of general weights than for unstandardised
-binary weights.
+the shape of the distribution is very sensitive to small \(n\), but for moderate \(n\) and global Moran’s \(I\), the effects are seen only further out
+in the tails. The consequences for local Moran’s \(I_i\) are much stronger, because the clique
+of neighbours of each observation is typically very small. It is perhaps
+of interest that the differences are much smaller for the case of
+general weights than for unstandardised binary weights.
## MoranSad Prop_unstdSad Prop_stdSad
@@ -829,13 +799,11 @@ Simulating measures of s
all((res >= alpha_0.05) == (ores[,c(1,3,5)] >= alpha_0.05))