Dear Tamar,

Theta cannot be zero in the first bit, as the documentation indicates. You can make theta very small, but not 0.

I don´t know where the commuteDistance error comes from, but the size of the matrix is certainly a factor to take into account. You could aggregate your data. Usually 1-2 million cells is OK. Pure random walks become mathematically quite meaningless in very large graphs (http://arxiv.org/abs/1003.1266). Also, the values in your cells make a difference. You should keep values in a range between 0 and 1 or (ideally) normalize your matrix for a pure random walk (e.g. transition probabilities sum to 1).

Also, biologically, random walks don´t make much sense, because it assumes that an organism will keep tirelessly moving until it hits a certain pixel. Tabitha Graves has shown that random walks don´t work very well in practice. 

Some goal-directedness or limits to the length of the walk are more realistic. RSP (also implemented in gdistance) would be an alternative to explore.

Best,

Jacob


On Friday, 6 June 2014, 2:34, Tamar Marcus <marcus@leuphana.de> wrote:
 


Hi All -

I am trying to create distance matrices between my 50 sampling points
using the various options available in gdistance, and am getting
strange error messages with the passage and commuteDistance functions.
I created a transition layer based on a conductance layer (also tried
with a resistance layer) created in arcGIS, with values of 0.0001
instead of 0 (so no isolated pixels) and then values ranging from
1-10. The conductance layer is pretty large - 2972 x 3925 pixels. The
costDistance function manages to run smoothly, but for the other 2
functions I get the errors listed below. I have tested the code with a
smaller layer and point set and it runs fine, but the issue is not RAM
(checked by running the code on a server and seeing RAM usage when it
threw the errors).

I would greatly appreciate any insight someone might have as to what
these errors mean and how I can possibly solve them. Google didn't
find much, but unfortunately that may be due to the Denglish, I
unfortunately need to run the code on a computer which has R installed
in German...

Many thanks!
Tamar

passage error - this one seems to be thrown not by R, but by something deeper:

cost.pass <- passage(tr_cond, orgin, destination, theta=0)


*** caught segfault ***

address 0x7fff5a83bf38, cause 'memory not mapped'



Traceback:

1: .solve.dgC(a, as(b, "denseMatrix"), tol = tol, sparse = sparse)

2: .local(a, b, ...)

3: solve(a, Matrix(b))

4: solve(a, Matrix(b))

5: eval(expr, envir, enclos)

6: eval(call, sys.frame(sys.parent()))

7: callGeneric(a, Matrix(b))

8: solve(t(IdMinusWj), ei)

9: solve(t(IdMinusWj), ei)

10: .probPass(x, Id, W, nr, ci, cj, tc, totalNet, output)

11: .randomShPaths(x, ci, cj, theta, tc, totalNet, output)

12: .local(x, origin, goal, theta, ...)

13: passage(tr_cond, orgin, destination, theta = 0)

14: passage(tr_cond, orgin, destination, theta = 0)



Possible actions:

1: abort (with core dump, if enabled)

2: normal R exit

3: exit R without saving workspace

4: exit R saving workspace




commuteDistance error:

cost.commute<- commuteDistance(tr_cond, sites)

Fehler in LU.dgC(a) :

  cs_lu(A) fehlgeschlagen: near-Singuläres A (oder außerhalb des Speichers)



The code I am using:

final.cond <- raster("all_cond.txt")
tr_cond <- transition(final.cond, transitionFunction=mean, directions=4)

xyfilename <- "plot coords_sch.csv"
XY <- read.csv(xyfilename, header=TRUE)
xvals <- XY[,1]
yvals <- XY[,2]
xy <- cbind(xvals,yvals)
sites <- SpatialPointsDataFrame(coords=
as.data.frame(xy),as.data.
frame(xy))

orgin <- sites
destination <- sites

cost.pass <- passage(tr_cond, orgin, destination, theta=0)
cost.dist <- costDistance(tr_cond, sites)
cost.commute<- commuteDistance(tr_cond, sites)

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

