[R] spatial cross-correlation

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Apr 1 11:35:37 CEST 2008

Dear Javier,

It seems to me that you want to calculate cross variograms. You can do
that with the gstat package. Have a look at the example in ?gstat

# let's do some manual fitting of two direct variograms and a cross
g <- gstat(id = "ln.zinc", formula = log(zinc)~1, locations = ~x+y, 
        data = meuse)
g <- gstat(g, id = "ln.lead", formula = log(lead)~1, locations = ~x+y, 
        data = meuse)
# examine variograms and cross variogram:
# enter direct variograms:
g <- gstat(g, id = "ln.zinc", model = vgm(.55, "Sph", 900, .05))
g <- gstat(g, id = "ln.lead", model = vgm(.55, "Sph", 900, .05))
# enter cross variogram:
g <- gstat(g, id = c("ln.zinc", "ln.lead"), model = vgm(.47, "Sph", 900,
# examine fit:
plot(variogram(g), model = g$model, main = "models fitted by eye")
# see also demo(cokriging) for a more efficient approach
g[c("ln.zinc", "ln.lead")]



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens jgarcia op ija.csic.es
Verzonden: dinsdag 1 april 2008 11:23
Aan: r-help op r-project.org
Onderwerp: [R] spatial cross-correlation

I cannot find in the R html documentation a way to evaluate
cross-correlation in 2D data sets.

I would like to evaluate cross-correlation in a series of moving windows
between two maps.

i,e, specify several windows inside the complete 2D spatial matrixes and
for each one ofthese windows evaluate the 2D cross-correlation (commonly
conducted in the spectral domain).

Thanks in advance and best wishes,

Javier GP

R-help op r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list