[tlocoh-info] T-LoCoH Hull Based Association Measures
lyons.andy at gmail.com
Mon May 19 09:52:46 CEST 2014
Thanks for your query. The general workflow for computing the mean
centroid distance for temporally overlapping hulls (of two individuals)
is below. More generally, if you find hull based measures of association
like these useful, or have suggestions on how they could be made more
useful or behavioral questions they could address, please let me know.
1. As needed, thin down your data so the sampling for the two
individuals is roughly the same (i.e., start at the same time, end at
the same time, and roughly the same sampling frequency). You can of
course do this outside of R, but functions in the T-LoCoH package that
were developed for this task include:
lxy.merge() - merges two or more Locoh-xy objects so the locations for
multiple individuals are saved in the same Locoh-xy object. If you
imported the movement data for multiple individuals in one fell swoop
(e.g., you imported a CSV file with a field for 'id' and turned that
into a Locoh-xy object with the xyt.lxy() function), your data may
already in a single Locoh-xy object.
Merging the trajectories of multiple individuals into a single locoh-xy
object will allow you to use the following two functions to view the
sampling of each individual and make the sampling between two (or more)
individuals as uniform as possible.
lxy.plot.freq() - to plot the sampling frequency of the locations of
multiple individuals, so you can see / verify when data collection for
each individual began and ended, and also the sampling intervals. The
Figures on pages 105 and 106 of my dissertation
were created with this function and describe it a little further.
lxy.thin.byfreq() - to selectively remove points from the trajectories
of each individual to achieve a common start time, a common end time,
and/or a common sampling intervals (or as close as you can get).
Next step is to create hullsets for individual. This involves picking
values for 's' and 'a' (or 'k'), as described in the tutorial. You may
wish to use the same value of 's' for all the individuals, or different
values based on a common selection process / principles. Given a single
Locoh-xy object with the locations for multiple individuals, you can
create the hullsets one-by-one by passing a value for the 'id' argument
in the lxy.lhs() function. It will probably help to create isopleths
(i.e., merged hulls) for the purposes of selecting value(s) of a or k,
but note that the metrics for temporally overlapping and spatially
overlapping hulls (that we'll create below) are based on the individual
_Merging Hullsets__(if needed)
If you created separate Locoh-hullset objects for the different
individuals, merge them together into a single Locoh-hullset object
using the lhs.merge() function. So for example if you are looking at
three individuals, you want to wind up with a Locoh-hullset object that
has hulls for three individuals (which can be based on different
parameters values of s, a, k)
_Creating metrics for temporally overlapping hulls__
Finally, you can create hull metrics for the mean centroid distance of
temporally overlapping hulls for pairs of individuals. You do this with
the lhs.to.add() function. Take note that these metrics are pairwise.
For example if you had hulls for individuals A, B, and C in the same
hullset, then after you run the function that were would be two new
metrics for individual A - the mean centroid distance for each one of
A's hulls that overlap in time with individual B, and the mean centroid
distance for hulls that overlap in time with individual C. Likewise for
the other two individuals. You can control what it means to be
"temporally overlapping" with the maxdt argument, noting that the time
stamp of each hull is the time stamp of the parent point. When data
sampling for two individuals is the same (e.g., one location per hour),
then in most cases there will be only one hull that overlaps in time
(although it depends on how you set the maxdt argument). In these cases,
the "mean centroid distance" the value of a single centroid-to-centroid
distance. The mean centroid distance for a pair of individuals will
normally be reciprocal, in other words the mcd of individual A with
respect to individual C will be the same as the mcd of individual C with
respect to A. You don't have to compute the mean centroid distance for
every pair of individuals (although it doesn't take long), rather you
can specify which pairs to analyze using the id and hs2.id arguments.
Note also in many cases the mean centroid distance of temporally
overlapping hulls will similar to the time matched point-to-point
distance of two individuals. It would be worth reflecting upon, and
articulating, the rationale for using mean centroid distance of hulls v.
the simpler point-to-point distance.
_Creating Metrics for Spatially Overlapping Hulls__
See function lhs.so.add(). This function can be slow because it has to
first identify which hulls from each individual overlap, which is time
consuming (in its current form). Similar to the hull metric for
temporally overlapping hulls, spatially overlapping hull metrics are
created for pairs of individuals. See the function help page for details.
On 5/13/2014 10:22 AM, Ambika Kamath wrote:
> Hi Andy,
> Thank you very much for your rapid response! I seem to have gotten
> gpclib to install, and the association metrics you describe definitely
> look useful. The mean centroid distance between temporally overlapping
> hulls is primarily what I'd want to calculate, but the other metrics
> seem very interesting as well. Are there functions within T-LoCoH to
> calculate these metrics, or will it be more complicated than that? I'm
> not quite sure where to begin--if there's any documentation you could
> point me to, that would be great!
> Many thanks again,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tlocoh-info