Alt_Alg: Calculates the residence times and identifies the sites of...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/Alt_Alg.R

Description

From positional data, this function finds the residence times as well as the number of visits. It also identifies which areas are sites of interest.

Usage

1
Alt_Alg(Name, t, X, Y, R, s = 10, m = 500, first = 'n', save = 'n')

Arguments

Name

name of the data, which is used for any saved files and plot titles

t

array of the times that the positions are recorded at

X

array of the x-coordinates describing the trajectory

Y

array of the y-coordinates describing the trajectory

R

radius value to use

s

number of time steps between checks for entrances and exits

m

estimate of the maximum number of crossings across all circles

first

if 'y', the algorithm will look for the second greatest maximum percent drop if the first results in the first circle being the only non-identified site

save

if 'y', save the files

Details

This is the main part of the algorithm. Given the trajectory of an animal, the algorithm centres a circle at the start of the trajectory. The next circle is centred at the point when the animal first leaves the previous circle. This is then repeated all along the trajectory until the whole trajectory is covered. The algorithm then finds the times of when the animal has crossed the perimeter of these circles, the results of which are saved in two csv files (comma separated values), with titles 'Name'_F_alt_R'R'.csv and 'Name'_B_alt_R'R'.csv for the forward and backward crossings respectively. A forward crossing is one that occurs after the time point that the circle is centred on and backward crossings occur before this.

The residence times and number of visits for each circle are calculated, which is also stored in a csv file with the title 'Name'_UD_alt_R'R'.csv. The function orders all the circles in descending order of residence time and then moving down the list, any that overlap with one of a higher residence time are removed. The relative difference between consecutive residence times (percent drops) are calculated and the maximum is identified (maximum_percent_drop). The number of identified sites (Number_identified_sites) is the number of circles before this maximum percent drop. This can be seen visually, using plot_bar_chart.

Value

max_percent_drop - maximum percent drop, which is the relative difference between the bars, indicating the difference between sites and non-site circles

number_identified_sites - number of circles identified as sites of interest

Author(s)

Rhys Munden <rdmunden1@sheffield.ac.uk>

References

Munden, R., Borger , L., Wilson, R.P., Redcliffe, J., Loison, A., Garel, M. and Potts, J.P. in review. Making sense of ultra-high-resolution movement data: an algorithm for inferring sites of interest.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##Find the current working directory
wd = getwd()
##Set the working directory as the temporary one
setwd(tempdir())
##Load the data
data(OU_14)
t=unlist(OU_14["t"])
X=unlist(OU_14["X"])
Y=unlist(OU_14["Y"])

##Calculate the residence time with a radius of 0.3 and not including the first circle
Alt_Alg("OU_14",t,X,Y,0.3,first='y',save='y')

##Reset the original working directory
setwd(wd)

SitesInterest documentation built on May 2, 2019, 4:25 a.m.