Learn R Programming

spdep (version 0.1-10)

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", 
  zero.policy = FALSE, spChk=NULL)
plot.spcor(x, main, ylab, ylim, ...)
print.spcor(x, ...)

Arguments

neighbours
an object of class nb
var
a numeric vector
order
maximum lag order
method
"corr" for correlation, "I" for Moran's I
style
style can take values W, B, C, and S
zero.policy
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
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 vector of coefficient values, with an attribute (cardnos) of tables of neighbour cardinalities for the lag orders used.

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

Examples

Run this code
data(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)
names(tr.SIDS74) <- rownames(nc.sids)
print(sp.correlogram(sidsorig.nb, tr.SIDS74, order=8, method="corr",
 zero.policy=TRUE))
print(sp.correlogram(sidsorig.nb, tr.SIDS74, order=8, method="I",
 zero.policy=TRUE))
plot(sp.correlogram(sidsorig.nb, tr.SIDS74, order=8, method="corr",
 zero.policy=TRUE))
drop.no.neighs <- !(1:length(sidsorig.nb) %in% which(card(sidsorig.nb) == 0))
sub.sidsorig.nb <- subset(sidsorig.nb, drop.no.neighs)
plot(sp.correlogram(sub.sidsorig.nb, subset(tr.SIDS74,  drop.no.neighs),
 order=8, method="corr"))

Run the code above in your browser using DataLab