Clement, Your explanation is very clear and better than what I had proposed. I'll check out mindistkeep -Roland
>>> <clement.cale...@oncfs.gouv.fr> 7/2/2009 9:58 AM >>> Hello Roland, Roland Kays writes: > Hi, I'm working on some GPS data at 15min intervals. I'd like to > take any consecutive locations that are closer than GPS error (say > 25m) and average them together to get one location for all time > steps. For example, when an animal is resting in a tree for an hour > the locations might still bounce around due to GPS error. > > I just ran through the adehabitat trajectory tools and didn't see > anything in there - any other suggestions? Actually, there is a function to deal with such cases in adehabitat: the function mindistkeep. This function does not return the average position, but the first position of the animal during the "resting period" (that is, if the distance between relocation i and i+1 is not greater than the threshold, the program keeps the coordinates of the relocation i for the time i+1). When I programmed this function, it appeared to me difficult to provide a general function returning the *average* relocation when the distance between relocations is below a threshold. Indeed, to program such a function, we should be able to identify clear trajectory segments in which *all* the between-relocations distances (distance (i, i+1), (i, i+2), (i, i+3), (i+2, i+1), etc.) are below the threshold. So that the relocations to be averaged could be clearly defined. In many cases, the limit is not that clear: think about an animal foraging very slowly, moving at a speed lower than the speed that could be detected when considering only consecutive relocations: in such cases, the distance between the relocation at time i+1 and relocation i may be below the threshold, and similarly for the distance (i+1, i+2), (i+2, i+3), but this movement could result into a distance (i, i+3) much greater than the threshold... How to compute the average in such cases? The function mindistkeep transform the relocations i, i+1, i+2, i+3, i+4 into the relocations i, i, i, i+3, i+3 if * the distance (i, i+1) < threshold, * (i, i+2) < threshold * (i, i+3) > threshold * (i+3, i+4) < threshold The algorithm is thus much clearer: it just consists of one rule: "the current relocation is to be considered as such if the distance to the previous one is greater than the threshold. Otherwise, consider that the animal have not moved.". Considering the average would be much more complicated: "the current relocation is located at the average (of what? if the relocations are clearly clustered below a given distance threshold ok, but otherwise?) if the distance to the previous one is greater than the threshold". I hope that these explanations are not to obscure... do not hesitate to ask precisions, otherwise! All the best, Clément. > thanks > Roland > > Roland Kays, Ph.D. > Curator of Mammals > New York State Museum > CEC 3140, Albany, NY 12230 > 518-486-3205, Fax: 518-486-2034 > > Research Lab: http://www.nysm.nysed.gov/staff/details.cfm?staffID=43 > Mammals Exhibit: http://www.nysm.nysed.gov/mammalsrevealed/intro.html > > > _______________________________________________ > AniMov mailing list > AniMov@faunalia.it > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov -- Clément CALENGE Office national de la chasse et de la faune sauvage Saint Benoist - 78610 Auffargis tel. (33) 01.30.46.54.14 _______________________________________________ AniMov mailing list AniMov@faunalia.it http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov