Skip to content
Prev 5118 / 7420 Next

Compute the distance between the trajectories of two animals with varying sampling intervals

Thank you for all your answers!

@ Krzysztof: Yes, I think an approximated method that uses only the nearest points to compute the distance will suffice. When I include a threshold that ensures that only temporal differences smaller than xy minutes are taken into consideration, reasonable results should be achievable.

@ Sarah: I think you are referring to the simulation of a Brownian motion by the function simm.bb()  for an exact solution? I could not find a function that directly computes the distances. Or did I miss something?

@ Jeremy: Thanks for the hint! A also stumbled upon the pathFrechet() / distFrechet() function of longitudinalData but rejected them because they seem not to include the temporal dimension. However, this seems to be only an erroneous information of inside-r. When I looked at the official reference manual I saw that distFrechet() considers the time as well.

@ Mathieu: That is pretty much what I am intending to do for a first (and possibly also final) try, thanks! So I need to input the ltray-object of the first individual  as 'from' and the other one as 'to' in order to check the distances between their closest points, right? I also tried to program something like that but the result is shockingly time inefficient and might still contain some errors. So I will probably try out your function tomorrow :)

Best regards
Andre



-----Urspr?ngliche Nachricht-----
Von: Mathieu Basille [mailto:basille.web at ase-research.org] 
Gesendet: Mittwoch, 22. Juli 2015 19:44
An: Andr? Zehnder; R-sig-eco
Cc: Jeremy Chacon; Sarah Goslee
Betreff: Re: [R-sig-eco] Compute the distance between the trajectories of two animals with varying sampling intervals

As far as I can tell, there is no such function in adehabitatLT. However, I wrote a function 'closest' [1] in the package 'hab' [2], which specifically does that: find the closest relocations from ltraj objects. It can work with only one ltraj, in which case it will look in other bursts, or with two different ltraj, in which case it will in the other ltraj. Most importantly, you can define a temporal windows to restrict the search, which may solve your problem of irregular time (the ltraj do not have to be regular, or on the same time schedule). It's only Euclidean distance though. Lastly, it works at the location level, i.e. it's not considering lines (steps). If that's what you're looking for, I would probably suggest using PostGIS...

Hope this helps,
Mathieu.


[1] https://github.com/basille/hab/blob/master/R/closest.r

[2] https://github.com/basille/hab


Le 22/07/2015 10:09, Jeremy Chacon a ?crit :