<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello again,<br>
<br>
okay, i found the ncf package and the correlog function.<br>
<br>
# correlog(x, y, z, w = NULL, increment, resamp = 100, latlon =
FALSE, na.rm = FALSE, quiet = FALSE)<br>
<br>
my short question is:<br>
<br>
<b>if latlon = T and the positions are "degree, decimal-minutes"
then increment has the unit of "km" and distance bins are in "km"
as well - is that correct ?</b><br>
<br>
I found it in the sourcecode :<br>
<br>
#then generating geographic distances<br>
if(latlon){<br>
#these are geographic distances from lat-lon
coordinates<br>
dmat <- matrix(0, nrow = n, ncol = n)<br>
for(i in 1:(n-1)) {<br>
for(j in (i+1):n) {<br>
dmat[j, i] <- gcdist(x[i], y[i],
x[j], y[j])<br>
dmat[i, j] <- dmat[j, i]<br>
<br>
with gcdist =<br>
<br>
r <- 360/(2 * pi)<br>
lon1 <- x1 / r<br>
lat1 <- y1 / r<br>
lon2 <- x2 / r<br>
lat2 <- y2 / r<br>
dlon <- lon2 - lon1<br>
dlat <- lat2 - lat1<br>
a <- (sin(dlat/2))^2 + cos(lat1) * cos(lat2) *
(sin(dlon/2))^2<br>
c <- 2 * atan2( sqrt(a), sqrt(1-a) )<br>
return(6370 * c)<br>
}<br>
<br>
but i cannot the answer from this....does gcdist deliver km units ?<br>
<br>
Cheers!<br>
jens<br>
<br>
<br>
<br>
<br>
<br>
Am 05.10.2010 12:57, schrieb Jens Floeter:
<blockquote cite="mid:4CAB0483.5090102@uni-hamburg.de" type="cite"> Dear
list members,
<br>
<br>
i need a hint - i am stuck on my search for a function.
<br>
<br>
I would like to calculate cross-correlograms between two variables
(predator and prey densities) and use this as an index of spatial
overlap.
<br>
<br>
I used the spdep pakcage and use e.g.
<br>
<br>
sp.correlogram(xy.data.nb, prey, order = 5 , method = "I",
zero.policy=TRUE, style = "W")
<br>
sp.correlogram(xy.data.nb, predator, order = 5 , method = "I",
zero.policy=TRUE, style = "W")
<br>
<br>
to calculate the (auto-) correlograms for predator and prey
individually.
<br>
<br>
But how do i combine them to calculate the cross-correlogram ?
<br>
<br>
Any hint would be highly appreciated...
<br>
<br>
Best wishes !
<br>
jens
<br>
<br>
_______________________________________________
<br>
R-sig-Geo mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:R-sig-Geo@stat.math.ethz.ch">R-sig-Geo@stat.math.ethz.ch</a>
<br>
<a class="moz-txt-link-freetext" href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a>
</blockquote>
</body>
</html>