Dear Karl,

Thanks for pointing this out. 

This is indeed a bug in the resistanceDistance function and I have just corrected this in the new version, which will be available on CRAN asap.

The distance matrix I get now is:

1        2        3
2 347.9649                  
3 347.9649 396.3933         
4 396.3933 347.9649 347.9649
Best,

Jacob.


________________________________
 From: karljarvis <karljarvis@gmail.com>
To: r-sig-geo@r-project.org 
Sent: Thursday, 10 May 2012, 18:16
Subject: Re: [R-sig-Geo] gdistance resistanceDistance error

Hi all,
As long as you're on the subject of the resistanceDistance function, I hope
you don't mind a different question.  In a homogeneous landscape, shouldn't
equidistant points have the same resistance values? There is no
directionality to this implementation of the circuitscape-type approach, so
in a symmetrical landscape the matrix should be symmetrical.  Right?

m <- matrix(1,10,10)
r <- raster(m)
t <- transition(r, mean, 8)
tg <- geoCorrection(t,type="c",multpl=FALSE)

x <- c(0.25,0.25,0.75,0.75)
y <- c(0.25,0.75,0.25,0.75)
xy <- cbind(x,y)

(rd <- resistanceDistance(tg,xy))

output:
         1        2        3
2 373.2277                  
3 243.5229 266.6885        
4 396.3933 322.7020 452.4068

The distance between each of these pairs of points are the same: (1,2),
(1,3), (2,4), (3,4), and these two are the same distance from each other:
(1,4), and (2,3).  So since all else is equal, why are their resistances
different?

Thanks,
Karl

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/gdistance-resistanceDistance-error-tp7076485p7548673.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
	[[alternative HTML version deleted]]

