Spatial correlograms for Moran's I and the autocorrelation coefficient, with print and plot helper functions.
1 2 3 4 5 6 
neighbours 
an object of class 
var 
a numeric vector 
order 
maximum lag order 
method 
"corr" for correlation, "I" for Moran's I, "C" for Geary's C 
style 

randomisation 
variance of I or C calculated under the assumption of randomisation, if FALSE normality 
zero.policy 
default NULL, use global option value; if FALSE stop with error for any empty neighbour sets, if TRUE permit the weights list to be formed with zerolength weights vectors 
spChk 
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use 
x 
an object from 
p.adj.method 
correction method as in 
main 
an overall title for the plot 
ylab 
a title for the y axis 
ylim 
the y limits of the plot 
... 
further arguments passed through 
The print function also calculates the standard deviates of Moran's I or Geary's C and a twosided probability value, optionally using p.adjust
to correct by the nymber of lags. The plot function plots a bar from the estimated Moran's I, or Geary's C value to +/ twice the square root of its variance (in previous releases only once, not twice). The table includes the count of included observations in brackets after the lag order. Care needs to be shown when interpreting results for few remaining included observations as lag order increases.
returns a list of class spcor
:
res 
for "corr" a vector of values; for "I", a matrix of estimates of "I", expectations, and variances 
method 
"I" or "corr" 
cardnos 
list of tables of neighbour cardinalities for the lag orders used 
var 
variable name 
Roger Bivand, Roger.Bivand@nhh.no
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, pp. 118–122, Martin, R. L., Oeppen, J. E. 1975 The identification of regional forecasting models using spacetime correlation functions, Transactions of the Institute of British Geographers, 66, 95–118.
nblag
, moran
, p.adjust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  example(nc.sids)
ft.SID74 < sqrt(1000)*(sqrt(nc.sids$SID74/nc.sids$BIR74) +
sqrt((nc.sids$SID74+1)/nc.sids$BIR74))
tr.SIDS74 < ft.SID74*sqrt(nc.sids$BIR74)
cspc < sp.correlogram(ncCC89_nb, tr.SIDS74, order=8, method="corr",
zero.policy=TRUE)
print(cspc)
plot(cspc)
Ispc < sp.correlogram(ncCC89_nb, tr.SIDS74, order=8, method="I",
zero.policy=TRUE)
print(Ispc)
print(Ispc, "bonferroni")
plot(Ispc)
Cspc < sp.correlogram(ncCC89_nb, tr.SIDS74, order=8, method="C",
zero.policy=TRUE)
print(Cspc)
print(Cspc, "bonferroni")
plot(Cspc)
drop.no.neighs < !(1:length(ncCC89_nb) %in% which(card(ncCC89_nb) == 0))
sub.ncCC89.nb < subset(ncCC89_nb, drop.no.neighs)
plot(sp.correlogram(sub.ncCC89.nb, subset(tr.SIDS74, drop.no.neighs),
order=8, method="corr"))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.