[R-sig-eco] Compute the distance between the trajectories of two animals with varying sampling intervals

Mathieu Basille basille.web at ase-research.org
Wed Jul 22 19:44:21 CEST 2015


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 :
> I bet Sarah's right and adehabitatLT has something, but I also know that
> the longitudinalData package can compute distances between two trajectories
> including the frechet distance.
>
> http://www.inside-r.org/packages/cran/longitudinalData/docs/pathFrechet
>
> However, it does not deal with the timing problem. You will have to roll
> your own method of aligning the trajectories in time.
>
> On Wed, Jul 22, 2015 at 9:02 AM, Sarah Goslee <sarah.goslee at gmail.com>
> wrote:
>
>> Try the adehabitatLT package.
>>
>> On Wed, Jul 22, 2015 at 9:41 AM, André Zehnder <andrezehnder at hotmail.com>
>> wrote:
>>> Hi list,
>>>
>>>
>>>
>>> I want to compute the distances between two trajectories that consist of
>> a
>>> sequence of point measurements. The trajectories do not have the same
>> length
>>> or sampling interval. So, while for animal A, there is a data point at
>> 15.00
>>> p.m. and another at 15.38 p.m, animal B might have data points at 14.56
>> p.m.
>>>
>>> and 17.02 p.m.
>>>
>>>
>>>
>>> A possible approach would be to connect these point series to
>> trajectories
>>> and then calculate the distance between the two trajectories at the
>> sampled
>>> positions of one trajectory (take the sampled position of the second
>>> trajectory that is temporally closest). Are there any packages in R (or
>>> tools outside of R) that allow me to do this? The support of other
>> distances
>>> than the Euclidean one (e.g. Fr chet) would be an advantage.
>>>
>>>
>>>
>>> Best regards,
>>>
>>> Andre
>>>
>>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
>
>

-- 

~$ whoami
Mathieu Basille
http://ase-research.org/basille

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard



More information about the R-sig-ecology mailing list