[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

libary(gstat)
data(meuse)
# let's do some manual fitting of two direct variograms and a cross
variogram
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:
plot(variogram(g))
# 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,
.03))
# examine fit:
plot(variogram(g), model = g$model, main = "models fitted by eye")
# see also demo(cokriging) for a more efficient approach
g["ln.zinc"]
g["ln.lead"]
g[c("ln.zinc", "ln.lead")]
g[1]
g[2]

HTH,

Thierry

------------------------------------------------------------------------
----
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
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.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
data.
~ 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

Hi;
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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list