Learn R Programming

spdep (version 0.5-3)

sp.correlogram: Spatial correlogram

Description

Spatial correlograms for Moran's I and the autocorrelation coefficient, with print and plot helper functions.

Usage

sp.correlogram(neighbours, var, order = 1, method = "corr",
 style = "W", randomisation = TRUE, zero.policy = NULL, spChk=NULL)
plot.spcor(x, main, ylab, ylim, ...)
print.spcor(x, p.adj.method="none", ...)

Arguments

neighbours
an object of class nb
var
a numeric vector
order
maximum lag order
method
"corr" for correlation, "I" for Moran's I, "C" for Geary's C
style
style can take values W, B, C, and S
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 zero-length weights vectors
spChk
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()
x
an object from sp.correlogram() of class spcor
p.adj.method
correction method as in p.adjust
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

Value

  • returns a list of class spcor:
  • resfor "corr" a vector of values; for "I", a matrix of estimates of "I", expectations, and variances
  • method"I" or "corr"
  • cardnoslist of tables of neighbour cardinalities for the lag orders used
  • varvariable name

Details

The print function also calculates the standard deviates of Moran's I or Geary's C and a two-sided 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).

References

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 space-time correlation functions, Transactions of the Institute of British Geographers, 66, 95--118.

See Also

nblag, moran, p.adjust

Examples

Run this code
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"))

Run the code above in your browser using DataLab