Title: | Filtering and Assessing the Sample Size of Tracking Data |
---|---|
Description: | Functions to filter GPS/Argos locations, as well as assessing the sample size for the analysis of animal distributions. The filters remove temporal and spatial duplicates, fixes located at a given height from estimated high tide line, and locations with high error as described in Shimada et al. (2012) <doi:10.3354/meps09747> and Shimada et al. (2016) <doi:10.1007/s00227-015-2771-0>. Sample size for the analysis of animal distributions can be assessed by the conventional area-based approach or the alternative probability-based approach as described in Shimada et al. (2021) <doi:10.1111/2041-210X.13506>. |
Authors: | Takahiro Shimada |
Maintainer: | Takahiro Shimada <[email protected]> |
License: | GPL-2 | file LICENSE |
Version: | 2.3.3 |
Built: | 2024-11-08 04:43:48 UTC |
Source: | https://github.com/takahiroshimada/sdlfilter |
Function to find horizontal asymptotes of a rational function.
asymptote( data = NULL, x = NULL, y = NULL, degree = "optim", upper.degree = 5, d1 = NA, d2 = NA, threshold = 0.95, proportional = TRUE, max.asymptote = 1, estimator = "glm", ci.level = 0.95, ... )
asymptote( data = NULL, x = NULL, y = NULL, degree = "optim", upper.degree = 5, d1 = NA, d2 = NA, threshold = 0.95, proportional = TRUE, max.asymptote = 1, estimator = "glm", ci.level = 0.95, ... )
data |
An output object from |
x , y
|
Numeric vectors of independent (x) and dependent (y) variables. These parameters will be ignored if data is supplied. |
degree |
The default 'optim' option selects the maximal degree of numerator and denominator of a rational function that minimises the mean squared error. Alternatively, an integer can be used to specify the maximal degree. The 'optim' option is recommended unless there is a strong reason that a maximal degree should be specified. |
upper.degree |
The upper limit of the maximal degree to be assessed when the 'optim' option is selected. Default is 5, meaning the "optimal" degree is searched from 1 and 10. The default usually gives good results. If the fit does not look good, a larger value may result in a better fit. |
d1 , d2
|
(Deprecated) Maximal degrees of numerator (d1) and denominator (d2) of a rational function. d1 and d2 must be equal. Use degree instead. |
threshold |
Threshold value for considering an asymptote. Once the y value reaches the threshold, it is considered that an asymptote is reached. |
proportional |
If TRUE (default), a threshold is calculated as estimated asymptote * threshold. If FALSE, the value specified in threshold is used in the analysis. |
max.asymptote |
The maximum limit of an expected asymptote. Default is 1 (i.e. maximum probability). If it is unknown, set as NA (e.g. max.asymptote = NA). |
estimator |
Method used to estimate the mean or predicted y relative to x (e.g. sample size).
Available options are 'mean' using arithmetic means and 'glm' using the |
ci.level |
Confidence level for the mean or predicted y, which will be used to assess if/when an asymptote has been reached. If NULL, only the mean and predicted y are used for the assessment (see details). |
... |
Optional arguments passed to |
This function fits a rational function to the input data.
When an output object from boot_overlap
, combn_overlap
or boot_area
is supplied,
a rational function is fit to the means or predicted values of the bootstrap results (e.g. mean overlap probability)
as a function of x (e.g. sample size).
It then estimates horizontal asymptotes and identifies the sample size when an asymptote is considered.
If ci.level = NULL and threshold = 0.95,
an asymptote is considered when the mean or predicted y value reaches above 95
If ci.level is specified (e.g. 0.95) and threshold = 0.95,
an asymptote is considered when the mean or predicted y value AND the confidence interval are above 95
When the "PHR" method was used in boot_overlap
,
binomial is generally a sensible family
object for the GLM.
gaussian and Gamma are often good options when the maximum y value exceeds 1 (e.g. area size).
Please caution if estimated horizontal asymptote is very different from the expected asymptote.
For example, the estimated horizontal asymptote should be around 1 when overlaps between UDs are calculated using the "PHR" method.
see boot_overlap
.
A list containing a data frame (rational function fit associated with x values), an estimated horizontal asymptote, the minimum sample size if an asymptote is reached, and the estimated optimal degree of numerator and denominator of the rational function.
Takahiro Shimada
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Press, W. H., S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery (2007). Numerical Recipes: The Art of Numerical Computing. Third Edition, Cambridge University Press, New York.
boot_overlap
, combn_overlap
, boot_area
This map layer outlines the coast of Australia.
Australia
Australia
A data.frame
A high resolution bathymetry model (100 m) for the Sandy Strait region developed by Beaman, R.J. (2010).
bathymodel
bathymodel
A stars
Beaman, R.J. (2010) Project 3DGBR: A high-resolution depth model for the Great Barrier Reef and Coral Sea. Marine and Tropical Sciences Research Facility (MTSRF) Project 2.5i.1a Final Report, MTSRF, Cairns, Australia, pp. 13 plus Appendix 1.
Function to calculate collective areas (merged x% Utilisation Distributions or UDs) of n individuals by bootstrapping.
boot_area( data, cell.size = NA, R = 1000, percent = 50, quantiles = c(0.25, 0.5, 0.75) )
boot_area( data, cell.size = NA, R = 1000, percent = 50, quantiles = c(0.25, 0.5, 0.75) )
data |
A matrix or list of RasterLayer/SpatRaster objects. Each row of the matrix or each RasterLayer/SpatRaster object contains a utilisation distribution (or other statistics that sums to 1 - e.g. proportion of time spent). The grid size and geographical extent must be consistent across each row of the matrix or each RasterLayer/SpatRaster object. The function assumes that each column of the matrix is associated with a unique geographical location or that each RasterLayer/SpatRaster has exactly the same geographical extent and resolution. |
cell.size |
A numeric value specifying the grid cell size of the input data in metres. |
R |
An integer specifying the number of iterations. A larger R is required when the sample size is large. R > sample size x 100 is recommended (e.g. R > 1000 for a sample size 10). |
percent |
An integer specifying the percent volume of each UD to be considered in the analysis. |
quantiles |
A vector or a number to specify the quantiles to be calculated in the summary of the results. |
This function calculates collective areas (e.g. 50% UDs) of 1 to n individuals by bootstrapping.
A list containing two data frames - raw results and summary (mean, sd, sem and quantiles at each sample size).
Takahiro Shimada
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
## Not run: #1 Utilisation distributions of flatback turtles (n = 15). data(ud_raster) #2 Calculate collective areas from 3000 random permutation area <- boot_area(ud_raster, R = 3000, percent = 50) #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(area, upper.degree = 10, estimator = 'glm', family = gaussian, max.asymptote = NA) #4 Plot the mean collective area and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x))+ geom_pointrange(aes(y = y, ymin = y_lwr, ymax = y_upr)) + geom_point(aes(y = y), size = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(name = expression(Area~(km^2)), labels=function(x) x/1e6) ## End(Not run)
## Not run: #1 Utilisation distributions of flatback turtles (n = 15). data(ud_raster) #2 Calculate collective areas from 3000 random permutation area <- boot_area(ud_raster, R = 3000, percent = 50) #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(area, upper.degree = 10, estimator = 'glm', family = gaussian, max.asymptote = NA) #4 Plot the mean collective area and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x))+ geom_pointrange(aes(y = y, ymin = y_lwr, ymax = y_upr)) + geom_point(aes(y = y), size = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(name = expression(Area~(km^2)), labels=function(x) x/1e6) ## End(Not run)
Function to calculate overlaps between UDs relative to sample size by bootstrapping.
boot_overlap( data, R = 1000, method = "PHR", percent = 100, quantiles = c(0.25, 0.5, 0.75) )
boot_overlap( data, R = 1000, method = "PHR", percent = 100, quantiles = c(0.25, 0.5, 0.75) )
data |
A matrix or list of RasterLayer/SpatRaster objects. Each row of the matrix or each RasterLayer/SpatRaster object contains a utilisation distribution (or other statistics that sums to 1 - e.g. proportion of time spent). The grid size and geographical extent must be consistent across each row of the matrix or each RasterLayer/SpatRaster object. The function assumes that each column of the matrix is associated with a unique geographical location or that each RasterLayer/SpatRaster has exactly the same geographical extent and resolution. |
R |
An integer specifying the number of iterations. A larger R is required when the sample size is large. R > sample size x 100 is recommended (e.g. R > 1000 for a sample size 10). |
method |
The overlap quantification method. "HR" is for the proportion of an individual's home range overlapped by the known habitats of other individuals. "PHR" is for the probability of an individual to be within the known habitats of other individuals. "VI", "BA" and "UDOI" quantify overlap between UDs using the full probabilistic properties as described in Fieberg and Kochanny (2005). For the latter three options, the function calculates overlaps between each additional UD and a collective UD. To generate a collective UD, each UD is overlaid and averaged at each grid cell so the probability density of the collective UD sums up to 1. |
percent |
An integer specifying the percent volume of each UD to be considered in the analysis. |
quantiles |
A vector or a number to specify the quantiles to be calculated in the summary of the results. |
This function calculates and bootstraps overlap between UDs based on the areas ("HR"), areas of collective UDs and the probability distribution of each individual ("PHR"), or the probability distribution of an individual and an averaged probability distribution of collective individuals ("VI", "BA", "UDOI").
A list containing two data frames - raw results and summary (mean, sd, sem and quantiles at each sample size).
Takahiro Shimada
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Fieberg J & Kochanny CO (2005) Quantifying home-range overlap: The importance of the utilization distribution. The Journal of Wildlife Management, 69(4), 1346–1359. doi:10.2193/0022-541x(2005)69[1346:Qhotio]2.0.Co;2
## Not run: #1 Utilisation uistributions of flatback turtles (n = 15). data(ud_matrix) #2 Calculate overlap probability from 2000 random permutation. overlap <- boot_overlap(ud_matrix, R = 2000, method = "PHR") #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(overlap, upper.degree = 10, estimator = 'glm', family = binomial) #4 Plot the mean probability and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x))+ geom_pointrange(aes(y = y, ymin = y_lwr, ymax = y_upr)) + geom_hline(yintercept = a$h.asymptote*0.95, linetype = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(limits = c(0.5,1), name = "Overlap probability") ## End(Not run)
## Not run: #1 Utilisation uistributions of flatback turtles (n = 15). data(ud_matrix) #2 Calculate overlap probability from 2000 random permutation. overlap <- boot_overlap(ud_matrix, R = 2000, method = "PHR") #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(overlap, upper.degree = 10, estimator = 'glm', family = binomial) #4 Plot the mean probability and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x))+ geom_pointrange(aes(y = y, ymin = y_lwr, ymax = y_upr)) + geom_hline(yintercept = a$h.asymptote*0.95, linetype = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(limits = c(0.5,1), name = "Overlap probability") ## End(Not run)
Function to calculate overlaps between all possible combination of UDs relative to sample size.
combn_overlap( data, method = "PHR", percent = 100, quantiles = c(0.25, 0.5, 0.75) )
combn_overlap( data, method = "PHR", percent = 100, quantiles = c(0.25, 0.5, 0.75) )
data |
A matrix or list of RasterLayer/SpatRaster objects. Each row of the matrix or each RasterLayer/SpatRaster object contains a utilisation distribution (or other statistics that sums to 1 - e.g. proportion of time spent). The grid size and geographical extent must be consistent across each row of the matrix or each RasterLayer/SpatRaster object. The function assumes that each column of the matrix is associated with a unique geographical location or that each RasterLayer/SpatRaster has exactly the same geographical extent and resolution. |
method |
The overlap quantification method. "HR" is for the proportion of an individual's home range overlapped by the known habitats of other individuals. "PHR" is for the probability of an individual to be within the known habitats of other individuals. "VI", "BA" and "UDOI" quantify overlap between UDs using the full probabilistic properties as described in Fieberg and Kochanny (2005). For the latter three options, the function calculates overlaps between each additional UD and a collective UD. To generate a collective UD, each UD is overlaid and averaged at each grid cell so the probability density of the collective UD sums up to 1. |
percent |
An integer specifying the percent volume of each UD to be considered in the analysis. |
quantiles |
A vector or a number to specify the quantiles to be calculated in the summary of the results. |
This function calculates overlap between all possible combination of input UDs based on the areas ("HR"), areas of collective UDs and the probability distribution of each individual ("PHR"), or the probability distribution of an individual and an averaged probability distribution of collective individuals ("VI", "BA", "UDOI").
A list containing two data frames - raw results and summary (mean, sd, sem and quantiles at each sample size).
Takahiro Shimada
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Fieberg J & Kochanny CO (2005) Quantifying home-range overlap: The importance of the utilization distribution. The Journal of Wildlife Management, 69(4), 1346–1359. doi:10.2193/0022-541x(2005)69[1346:Qhotio]2.0.Co;2
## Not run: #1 Utilisation uistributions of flatback turtles (n = 15). data(ud_matrix) #2 Calculate overlap probability from all combination of the UDs. overlap <- combn_overlap(ud_matrix, method = "PHR") #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(overlap, upper.degree = 10, ci.level = NULL) #4 Plot the mean probability and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x, y = y))+ geom_point() + geom_hline(yintercept = a$h.asymptote*0.95, linetype = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(limits = c(0.5,1), name = "Overlap probability") ## End(Not run)
## Not run: #1 Utilisation uistributions of flatback turtles (n = 15). data(ud_matrix) #2 Calculate overlap probability from all combination of the UDs. overlap <- combn_overlap(ud_matrix, method = "PHR") #3 Find the minimum sample size required to estimate the general distribution. a <- asymptote(overlap, upper.degree = 10, ci.level = NULL) #4 Plot the mean probability and rational function fit relative to the sample sizes. ggplot(data = a$results, aes(x = x, y = y))+ geom_point() + geom_hline(yintercept = a$h.asymptote*0.95, linetype = 2) + scale_x_continuous(breaks = seq(0, 15, 3), limits = c(2,15), name = "Animals tracked (n)") + scale_y_continuous(limits = c(0.5,1), name = "Overlap probability") ## End(Not run)
Function to remove locations by a data driven filter as described in Shimada et al. (2012).
ddfilter(sdata, vmax = 8.9, vmaxlp = 1.8, qi = 4, ia = 90, method = 1)
ddfilter(sdata, vmax = 8.9, vmaxlp = 1.8, qi = 4, ia = 90, method = 1)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
vmax |
A numeric value specifying a threshold of speed from a previous and/or to a subsequent fix.
Default is 8.9km/h.
If this value is unknown, it can be estimated from sdata using the function |
vmaxlp |
A numeric value specifying a threshold of speed, which is used to evaluate the locations of loop trips.
Default is 1.8 km/h.
If this value is unknown, it can be estimated from sdata using the function |
qi |
An integer specifying a threshold of quality index, which is used to evaluate the locations of loop trips. Default is 4. |
ia |
An integer specifying a threshold of inner angle, which is used to evaluate the locations of loop trips. Default is 90 degrees. |
method |
An integer (1 or 2) specifying how locations should be filtered with vmax. Default is 1 (both way) and removes a location if the speed from a previous AND to a subsequent location exceeds vmax. Select 2 (one way) to remove a location if the speed from a previous OR to a subsequent location exceeds vmax. For the latter, the filter examines successive suspect locations (i.e. the speed from a previous and/or to a subsequent location exceeds vmax) and retain one location that is associated with the minimum speed from a previous and/or to a subsequent location. |
Locations are removed if the speed from a previous and/or to a subsequent location exceeds vmax,
or if all of the following criteria apply: the associated quality index is less than or equal to qi,
the inner angle is less than or equal to ia and the speed either from a previous
or to a subsequent location exceeds vmaxlp.
If vmax and vmaxlp are unknown, they can be estimated using the functions vmax
and vmaxlp
respectively.
The input data is returned without locations identified by this filter. The following columns are added: "pTime", "sTime", "pDist", "sDist", "pSpeed", "sSpeed", "inAng". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "pSpeed" and "sSpeed" are linear speed from a previous and to a subsequent fix respectively. "inAng" is the degree between the bearings of lines joining successive location points.
Takahiro Shimada
Shimada T, Jones R, Limpus C, Hamann M (2012) Improving data retention and home range estimates by data-driven screening. Marine Ecology Progress Series 457:171-180 doi:10.3354/meps09747
ddfilter_speed
, ddfilter_loop
, vmax
, vmaxlp
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## A Map for the example site data(Australia) data(SandyStrait) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=5/60, step.dist=0.001) #### ddfilter ## Using the built-in function to estimate the threshold speeds V <- vmax(turtle.dup) VLP <- vmaxlp(turtle.dup) turtle.dd <- ddfilter(turtle.dup, vmax=V, vmaxlp=VLP) ## Or using user specified threshold speeds turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, vmaxlp=2.0) #### Plot data removed or retained by ddfilter ## Entire area p1 <- to_map(turtle.dup, bgmap=Australia, point.size = 2, line.size = 0.5, axes.lab.size = 0, multiplot = FALSE, point.bg = "red", title.size=15, title="Entire area")[[1]] + geom_point(aes(x=lon, y=lat), data=turtle.dd, size=2, fill="yellow", shape=21)+ geom_point(aes(x=x, y=y), data=data.frame(x=c(154, 154), y=c(-22, -22.5)), size=3, fill=c("yellow", "red"), shape=21) + annotate("text", x=c(154.3, 154.3), y=c(-22, -22.5), label=c("Retained", "Removed"), colour="black", size=4, hjust = 0) ## Zoomed in p2 <- to_map(turtle.dup, bgmap=SandyStrait, xlim=c(152.7, 153.2), ylim=(c(-25.75, -25.24)), axes.lab.size = 0, point.size = 2, point.bg = "red", line.size = 0.5, multiplot = FALSE, title.size=15, title="Zoomed in")[[1]] + geom_path(aes(x=lon, y=lat), data=turtle.dd, linewidth=0.5, colour="black", linetype=1) + geom_point(aes(x=lon, y=lat), data=turtle.dd, size=2, colour="black", shape=21, fill="yellow") gridExtra::marrangeGrob(list(p1, p2), nrow=1, ncol=2)
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## A Map for the example site data(Australia) data(SandyStrait) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=5/60, step.dist=0.001) #### ddfilter ## Using the built-in function to estimate the threshold speeds V <- vmax(turtle.dup) VLP <- vmaxlp(turtle.dup) turtle.dd <- ddfilter(turtle.dup, vmax=V, vmaxlp=VLP) ## Or using user specified threshold speeds turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, vmaxlp=2.0) #### Plot data removed or retained by ddfilter ## Entire area p1 <- to_map(turtle.dup, bgmap=Australia, point.size = 2, line.size = 0.5, axes.lab.size = 0, multiplot = FALSE, point.bg = "red", title.size=15, title="Entire area")[[1]] + geom_point(aes(x=lon, y=lat), data=turtle.dd, size=2, fill="yellow", shape=21)+ geom_point(aes(x=x, y=y), data=data.frame(x=c(154, 154), y=c(-22, -22.5)), size=3, fill=c("yellow", "red"), shape=21) + annotate("text", x=c(154.3, 154.3), y=c(-22, -22.5), label=c("Retained", "Removed"), colour="black", size=4, hjust = 0) ## Zoomed in p2 <- to_map(turtle.dup, bgmap=SandyStrait, xlim=c(152.7, 153.2), ylim=(c(-25.75, -25.24)), axes.lab.size = 0, point.size = 2, point.bg = "red", line.size = 0.5, multiplot = FALSE, title.size=15, title="Zoomed in")[[1]] + geom_path(aes(x=lon, y=lat), data=turtle.dd, linewidth=0.5, colour="black", linetype=1) + geom_point(aes(x=lon, y=lat), data=turtle.dd, size=2, colour="black", shape=21, fill="yellow") gridExtra::marrangeGrob(list(p1, p2), nrow=1, ncol=2)
A partial component of ddfilter
, although works as a stand-alone function.
This function removes locations by speed, inner angle, and quality index as described in Shimada et al. (2012).
ddfilter_loop(sdata, qi = 4, ia = 90, vmaxlp = 1.8)
ddfilter_loop(sdata, qi = 4, ia = 90, vmaxlp = 1.8)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
qi |
An integer specifying a threshold of quality index, which is used to evaluate the locations of loop trips. Default is 4. |
ia |
An integer specifying a threshold of inner angle, which is used to evaluate the locations of loop trips. Default is 90 degrees. |
vmaxlp |
A numeric value specifying a threshold of speed, which is used to evaluate the locations of loop trips.
Default is 1.8 km/h.
If this value is unknown, it can be estimated from sdata using the function |
This function removes locations if all of the following criteria apply:
the number of source satellites are less than or equal to qi,
the inner angle is less than and equal to ia and the speed either from a previous or to a subsequent location exceeds vmaxlp.
If vmaxlp is unknown, it can be estimated using the function vmaxlp
.
The input data is returned without locations identified by this filter. The following columns are added: "pTime", "sTime", "pDist", "sDist", "pSpeed", "sSpeed", "inAng". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "pSpeed" and "sSpeed" are linear speed from a previous and to a subsequent fix respectively. "inAng" is the degree between the bearings of lines joining successive location points.
Takahiro Shimada
Shimada T, Jones R, Limpus C, Hamann M (2012) Improving data retention and home range estimates by data-driven screening. Marine Ecology Progress Series 457:171-180 doi:10.3354/meps09747
ddfilter
, ddfilter_speed
, vmaxlp
A partial component of ddfilter
, although works as a stand-alone function.
This function removes locations by a given threshold speed as described in Shimada et al. (2012).
ddfilter_speed(sdata, vmax = 8.9, method = 1)
ddfilter_speed(sdata, vmax = 8.9, method = 1)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
vmax |
A numeric value specifying a threshold of speed from a previous and/or to a subsequent fix.
Default is 8.9km/h.
If this value is unknown, it can be estimated from sdata using the function |
method |
An integer (1 or 2) specifying how locations should be filtered. Default is 1 and removes a location if the speed from a previous AND to a subsequent location exceeds vmax. Select 2 to remove a location if the speed from a previous OR to a subsequent location exceeds vmax. For the latter, the filter examines successive suspect locations (i.e. the speed from a previous and/or to a subsequent location exceeds vmax) and retain one location that is associated with the minimum speed from a previous and to a subsequent location. |
This function removes locations if the speed from a previous and/or to a subsequent location exceeds a given threshold speed.
If vmax is unknown, it can be estimated using the function vmax
.
The input data is returned without locations identified by this filter. The following columns are added: "pTime", "sTime", "pDist", "sDist", "pSpeed", "sSpeed". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "pSpeed" and "sSpeed" are linear speed from a previous and to a subsequent fix respectively.
Takahiro Shimada
Shimada T, Jones R, Limpus C, Hamann M (2012) Improving data retention and home range estimates by data-driven screening. Marine Ecology Progress Series 457:171-180 doi:10.3354/meps09747
ddfilter
, ddfilter_loop
, vmax
, track_param
Function to filter locations according to bathymetry and tide.
depthfilter( sdata, bathymetry, bilinear = TRUE, qi = 4, tide, tidal.plane, type = "HT", height = 0, filter = TRUE )
depthfilter( sdata, bathymetry, bilinear = TRUE, qi = 4, tide, tidal.plane, type = "HT", height = 0, filter = TRUE )
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
bathymetry |
A stars object containing bathymetric data in metres. Negative and positive values indicate below and above the water respectively. Geographic coordinate system is WGS84. |
bilinear |
Logical. This defines a method for how to extract cell values from the bathymetry layer.
Options are bilinear (TRUE) or nearest neighbour (False) as inherited from |
qi |
An integer specifying a threshold of quality index. depthfilter does not filter a location that is associated with a quality index higher than this threshold. Default is 4. |
tide |
A data frame containing columns with the following headers: "tideDT", "reading", "standard.port".
"tideDT" is date & time in class |
tidal.plane |
A data frame containing columns with the following headers: "standard.port", "secondary.port", "lat", "lon", "timeDiff", "datumDiff". "standard.port" is the identifier for a tidal observation station. "secondary.port" is the identifier for a station at which tide is only predicted using tidal records observed at the related standard port. "lat" and "lon" are the latitude and longitude of each secondary port in decimal degrees. "timeDiff" is the time difference between standard port and its associated secondary port. "datumDiff" is the baseline difference in metres if bathymetry and tidal observations/predictions uses different datum (e.g. LAT and MSL). |
type |
The type of water depth considered in the filtering process. "exp" is for the water depth experienced by the animal at the time. This option may be applicable to species that remain in water at all times (e.g. dugongs, dolphins, etc). "HT" is for the water depth at the nearest high tide (default). This option is useful for animals that use inter-tidal zones at high tide and may remain there even after the tide drops (e.g. some sea turtles). |
height |
A numerical value to adjust the water depth an animal is likely to use. Default is 0 m. This parameter is useful if the minimum water depth used by the animal is known. For example, a dugong is unlikely to use water shallower than its body height (e.g. ~0.5 m) so it may be sensible to consider the fix is an error if the estimated water depth is shallower than its body height. A negative value indicates below the water surface. For the dugong example, to remove locations for which the water depth was <0.5 m, it should be specified as; height = -0.5. By supplying the body height to this argument, all the locations recorded shallower than its body will be removed. |
filter |
Default is TRUE. If FALSE, the function does not filter locations but it still returns estimates of the water depth experienced by the animal at each location. |
The function examines each location according to the water depth experienced by the animal or the water depth at the nearest high tide. The function looks for the closest match between each fix and tidal observations or predictions in temporal and spatial scales. When filter is disabled, the function does not filter locations but returns the estimated water depth of each location with the tide effect considered (bathymetry + tide).
When filter option is enabled, this function filters the input data and returns with two additional columns; "depth.exp", "depth.HT". "depth.exp" is the estimated water depth at each location at the time of location fixing. "depth.HT" is the estimated water depth at the nearest high tide at each location.
The input data must not contain temporal or spatial duplicates.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
Beaman, R.J. (2010) Project 3DGBR: A high-resolution depth model for the Great Barrier Reef and Coral Sea. Marine and Tropical Sciences Research Facility (MTSRF) Project 2.5i.1a Final Report, MTSRF, Cairns, Australia, pp. 13 plus Appendix 1.
## Not run: #### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## Bathymetry model developed by Beaman (2010) data(bathymodel) ## A tidal plane for the example site data(tidalplane) ## Tidal observations and predictions for the example site data(tidedata) ## Maps for the example site data(SandyStrait) #### Remove temporal and/or spatial duplicates and biologically unrealistic fixes turtle.dd <- ddfilter(dupfilter(turtle)) #### Apply depthfilter turtle <- depthfilter(sdata = turtle.dd, bathymetry = bathymodel, tide = tidedata, tidal.plane = tidalplane) #### Plot data removed or retained by depthfilter to_map(turtle.dd, bgmap = SandyStrait, point.bg = "red", point.size = 2, line.size = 0.5, axes.lab.size = 0, title.size = 0, multiplot = FALSE)[[1]] + geom_point(aes(x = lon, y = lat), data = turtle, size = 2, fill = "yellow", shape = 21)+ geom_point(aes(x = x, y = y), data = data.frame(x = c(152.68, 152.68), y = c(-25.3, -25.34)), size = 3, fill = c("yellow", "red"), shape = 21) + annotate("text", x = c(152.7, 152.7), y = c(-25.3, -25.34), label = c("Retained", "Removed"), colour = "black", size = 4, hjust = 0) ## End(Not run)
## Not run: #### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## Bathymetry model developed by Beaman (2010) data(bathymodel) ## A tidal plane for the example site data(tidalplane) ## Tidal observations and predictions for the example site data(tidedata) ## Maps for the example site data(SandyStrait) #### Remove temporal and/or spatial duplicates and biologically unrealistic fixes turtle.dd <- ddfilter(dupfilter(turtle)) #### Apply depthfilter turtle <- depthfilter(sdata = turtle.dd, bathymetry = bathymodel, tide = tidedata, tidal.plane = tidalplane) #### Plot data removed or retained by depthfilter to_map(turtle.dd, bgmap = SandyStrait, point.bg = "red", point.size = 2, line.size = 0.5, axes.lab.size = 0, title.size = 0, multiplot = FALSE)[[1]] + geom_point(aes(x = lon, y = lat), data = turtle, size = 2, fill = "yellow", shape = 21)+ geom_point(aes(x = x, y = y), data = data.frame(x = c(152.68, 152.68), y = c(-25.3, -25.34)), size = 3, fill = c("yellow", "red"), shape = 21) + annotate("text", x = c(152.7, 152.7), y = c(-25.3, -25.34), label = c("Retained", "Removed"), colour = "black", size = 4, hjust = 0) ## End(Not run)
This function removes locations that are located beyond a specified distance.
distfilter(sdata, max.dist = 100, method = 1, ia = NA)
distfilter(sdata, max.dist = 100, method = 1, ia = NA)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon".
See the data |
max.dist |
A numeric value specifying a threshold of distance between successive locations. Default is 100 km. |
method |
An integer specifying how locations should be filtered with max.dist. A location is removed if the distance from a previous and(1)/or(2) to a subsequent location exceeds max.dist. Default is 1 (both way). |
ia |
An integer (0 to 180) specifying an inner angle (in degrees) between consecutive locations, beyond which the locations are considered potential outliers. Default (NA) ignores this option. See details. |
This function removes locations if the distance from a previous and/or to a subsequent location exceeds max.dist and the inner angle is less than ia. If ia is NA (default), inner angles are not considered in the filtering.
The input data is returned without locations identified by this filter. The following columns are added: "pDist", "sDist", 'inAng'. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "inAng" is the degree between the bearings of lines joining successive location points.
Takahiro Shimada
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## A Map for the example site data(Australia) data(SandyStrait) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=1/60, step.dist=0.001) #### distfilter turtle.dist <- distfilter(turtle.dup, max.dist = 50, ia = 20) #### Plot data removed or retained by ddfilter ## Entire area p1 <- to_map(turtle.dup, bgmap=Australia, point.size = 2, line.size = 0.5, axes.lab.size = 0, multiplot = FALSE, point.bg = "red", title.size=15, title="Entire area")[[1]] + geom_point(aes(x=lon, y=lat), data=turtle.dist, size=2, fill="yellow", shape=21)+ geom_point(aes(x=x, y=y), data=data.frame(x=c(154, 154), y=c(-22, -22.5)), size=3, fill=c("yellow", "red"), shape=21) + annotate("text", x=c(154.3, 154.3), y=c(-22, -22.5), label=c("Retained", "Removed"), colour="black", size=4, hjust = 0) ## Zoomed in p2 <- to_map(turtle.dup, bgmap=SandyStrait, xlim=c(152.7, 153.2), ylim=(c(-25.75, -25.24)), axes.lab.size = 0, point.size = 2, point.bg = "red", line.size = 0.5, multiplot = FALSE, title.size=15, title="Zoomed in")[[1]] + geom_path(aes(x=lon, y=lat), data=turtle.dist, linewidth=0.5, colour="black", linetype=1) + geom_point(aes(x=lon, y=lat), data=turtle.dist, size=2, colour="black", shape=21, fill="yellow") gridExtra::marrangeGrob(list(p1, p2), nrow=1, ncol=2)
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) ## A Map for the example site data(Australia) data(SandyStrait) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=1/60, step.dist=0.001) #### distfilter turtle.dist <- distfilter(turtle.dup, max.dist = 50, ia = 20) #### Plot data removed or retained by ddfilter ## Entire area p1 <- to_map(turtle.dup, bgmap=Australia, point.size = 2, line.size = 0.5, axes.lab.size = 0, multiplot = FALSE, point.bg = "red", title.size=15, title="Entire area")[[1]] + geom_point(aes(x=lon, y=lat), data=turtle.dist, size=2, fill="yellow", shape=21)+ geom_point(aes(x=x, y=y), data=data.frame(x=c(154, 154), y=c(-22, -22.5)), size=3, fill=c("yellow", "red"), shape=21) + annotate("text", x=c(154.3, 154.3), y=c(-22, -22.5), label=c("Retained", "Removed"), colour="black", size=4, hjust = 0) ## Zoomed in p2 <- to_map(turtle.dup, bgmap=SandyStrait, xlim=c(152.7, 153.2), ylim=(c(-25.75, -25.24)), axes.lab.size = 0, point.size = 2, point.bg = "red", line.size = 0.5, multiplot = FALSE, title.size=15, title="Zoomed in")[[1]] + geom_path(aes(x=lon, y=lat), data=turtle.dist, linewidth=0.5, colour="black", linetype=1) + geom_point(aes(x=lon, y=lat), data=turtle.dist, size=2, colour="black", shape=21, fill="yellow") gridExtra::marrangeGrob(list(p1, p2), nrow=1, ncol=2)
Function to filter temporal and spatial duplicates in tracking data and retain only a single fix per time and location.
dupfilter( sdata, step.time = 0, step.dist = 0, conditional = FALSE, no.cores = 1 )
dupfilter( sdata, step.time = 0, step.dist = 0, conditional = FALSE, no.cores = 1 )
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
step.time |
Consecutive locations less than or equal to step.time apart are considered temporal duplicates. Default is 0 hours. |
step.dist |
Consecutive locations less than or equal to step.dist apart are considered spatial duplicates. Default is 0 kilometres. |
conditional |
If TRUE, spatial duplicates are filtered only if they are less than or equal to step.time apart. Default is FALSE. |
no.cores |
An integer specifying the number of cores used for parallel computing. Alternatively, type in 'detect' to use the maximum number of available cores minus one. |
This function filters temporal and spatial duplicates in tracking data. It first filters temporally and spatially exact locations. It then looks for temporal duplicates and retains a fix with the highest quality index. When temporal or spatial duplicates are associated with the same quality index, the function retains a location that is nearest from a previous and to a subsequent location.
The input data frame is returned containing only a single fix (latitude/longitude pair) per time and location. The following columns are added: "pTime", "sTime", "pDist", "sDist". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
dupfilter_exact
, dupfilter_qi
, dupfilter_time
, dupfilter_space
, track_param
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) #### Apply dupfilter turtle.dup <- dupfilter(turtle)
#### Load data sets ## Fastloc GPS data obtained from a green turtle data(turtle) #### Apply dupfilter turtle.dup <- dupfilter(turtle)
Function to filter temporally and spatially exact locations in tracking data.
dupfilter_exact(sdata)
dupfilter_exact(sdata)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
This is a partial component of dupfilter
, although works as a stand-alone function.
It looks for temporally and spatially exact locations and retains only a single fix (latitude/longitude pair) per time and location.
The input data frame is returned with temporally and spatially exact duplicates removed.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
dupfilter
, dupfilter_qi
, dupfilter_time
, dupfilter_space
Function to filter temporal duplicates in tracking data by quality index.
dupfilter_qi(sdata = sdata, step.time = 0)
dupfilter_qi(sdata = sdata, step.time = 0)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "qi".
See the data |
step.time |
Consecutive locations less than or equal to step.time apart are considered temporal duplicates. Default is 0 hours. |
This function is a partial component of dupfilter
, although works as a stand-alone function.
It looks for temporal duplicates and retains a fix with the highest quality index.
The input data frame is returned with temporal duplicates removed by the quality index. The following columns are added: "pTime", "sTime". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
dupfilter
, dupfilter_exact
, dupfilter_time
, dupfilter_space
, track_param
Function to filter spatial duplicates in tracking data.
dupfilter_space( sdata, step.time = 0, step.dist = 0, conditional = FALSE, no.cores = 1 )
dupfilter_space( sdata, step.time = 0, step.dist = 0, conditional = FALSE, no.cores = 1 )
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
step.time |
Consecutive locations less than or equal to step.time apart are considered temporal duplicates. Default is 0 hours. |
step.dist |
Consecutive locations less than or equal to step.dist apart are considered spatial duplicates. Default is 0 kilometres. |
conditional |
If TRUE, spatial duplicates are filtered only if they are less than or equal to step.time apart. Default is FALSE. |
no.cores |
An integer specifying the number of cores used for parallel computing. Alternatively, type in 'detect' to use the maximum number of available cores minus one. |
This function is a partial component of dupfilter
, although works as a stand-alone function.
First it identifies spatial duplicates by searching for consecutive fixes that were located within step.dist.
For each group of spatial duplicates, the function then retains a single fix that is nearest from a previous and to a subsequent location.
The input data frame is returned with spatial duplicates removed. The following columns are added: "pTime", "sTime", "pDist", "sDist". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively.
A minimum of two locations per id is required.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
dupfilter
, dupfilter_exact
, dupfilter_time
, dupfilter_qi
, track_param
Function to filter temporal duplicates that are associated with the same quality index.
dupfilter_time(sdata, step.time = 0, no.cores = 1)
dupfilter_time(sdata, step.time = 0, no.cores = 1)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
step.time |
Consecutive locations less than or equal to step.time apart are considered temporal duplicates. Default is 0 hours. |
no.cores |
An integer specifying the number of cores used for parallel computing. Alternatively, type in 'detect' to use the maximum number of available cores minus one. |
This is a partial component of dupfilter
, although works as a stand-alone function.
First it identifies temporal duplicates by searching for consecutive locations that were obtained within step.time.
For each group of temporal duplicates, the function then retains a single fix that is nearest from a previous and to a subsequent location.
The input data frame is returned with temporal duplicates removed. The following columns are added: "pTime", "sTime", "pDist", "sDist". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively.
Takahiro Shimada
Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 doi:10.1007/s00227-015-2771-0
dupfilter
, dupfilter_exact
, dupfilter_qi
, dupfilter_space
, track_param
Satellite tracking data of 15 flatback turtles (Natator depressus) that nested in Curtis Island, Australia. This sample data is a subset of the tracking data used in Shimada et al. (2021).
flatback
flatback
A data frame with 1020 rows and 4 variables:
identifier for each animal.
GMT date & time of each location in class POSIXct
.
longitude in UTM.
latitude in UTM.
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Function to calculate a percent volume on a utilisation distribution (UD)
percent_vol(x, percent = 100)
percent_vol(x, percent = 100)
x |
A vector containing the probability density. |
percent |
An integer specifying the percent volume of a UD to be considered. |
This function calculates a percent volume on a UD. The probability beyond the specified range will be assigned with a zero value.
A vector containing the specified percent volume.
Takahiro Shimada
This map layer outlines the coast around Sandy Strait, Australia.
SandyStrait
SandyStrait
A data.frame
A semidiurnal tidal plane table containing the height of the mean tidal planes and the average time differences of tide at different locations within Sandy Strait.
tidalplane
tidalplane
A data frame with 2 rows and 6 variables:
identifier for a tidal observation station.
identifier for a station at which tide is only predicted using the tidal records observed at the related standard port.
latitude in decimal degrees.
longitude in decimal degrees.
time difference between standard port and its associated secondary port.
baseline difference in metres between the bathymetry model and tidal observations/predictions, if each data uses different datum (e.g. LAT and MSL).
The State of Queensland (Department of Transport and Main Roads), Tidal planes.
A dataset containing tidal observations recorded at Bundaberg, Australia
tidedata
tidedata
A data frame with 26351 rows and 3 variables:
GMT date & time of each observation in class POSIXct
.
observed tidal height in metres.
identifier of the tidal station.
The State of Queensland (Department of Transport and Main Roads), Tidal data.
Function to plot tracking data on a map or a satellite image.
to_map( sdata, xlim = NULL, ylim = NULL, margin = 10, bgmap = NULL, google.key = NULL, map.bg = "grey", map.col = "black", zoom = NULL, point.bg = "yellow", point.col = "black", point.symbol = 21, point.size = 1, line.col = "lightgrey", line.type = 1, line.size = 0.5, title = "id", title.size = 11, axes.text.size = 11, axes.lab.size = 11, multiplot = TRUE, nrow = 1, ncol = 1 )
to_map( sdata, xlim = NULL, ylim = NULL, margin = 10, bgmap = NULL, google.key = NULL, map.bg = "grey", map.col = "black", zoom = NULL, point.bg = "yellow", point.col = "black", point.symbol = 21, point.size = 1, line.col = "lightgrey", line.type = 1, line.size = 0.5, title = "id", title.size = 11, axes.text.size = 11, axes.lab.size = 11, multiplot = TRUE, nrow = 1, ncol = 1 )
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon".
The function creates a map for each unique "id" (e.g. transmitter number, identifier for each animal).
"DateTime" is the GMT date & time of each location in class |
xlim , ylim
|
Limits for x and y axes. If not specified, the values are determined as the maximum range of the input data plus an additional margin (see margin). |
margin |
Set the amount of spaces added around the periphery of the plot. The value is scaled to the plot. The smaller value increases the margin. |
bgmap |
A data frame of a background map data, containing the following headers: "long", "lat", "group".
If not specified, the |
google.key |
If Google Maps are queried, a valid API key (a string) needs to be specified here. See |
map.bg |
Background colour of the map. This argument is ignored when any Google Maps is selected. |
map.col |
Outline colour of the map. This argument is ignored when any Google Maps is selected. |
zoom |
Map zoom for Google Maps. Default (NULL) to estimate the zoom from each data set.
For other options, see |
point.bg |
The colour to fill in a symbol. |
point.col |
The colour for the outline of a symbol. |
point.symbol |
An integer or a string to specify the symbol type. See |
point.size |
An integer to specify the size of the symbol. |
line.col |
The colour of the line that connects consecutive points. |
line.type |
The type of the line that connects consecutive points. See |
line.size |
An integer to specify the thickness (width) of the line that connects consecutive points. |
title |
The main title for each plot. If not specified, the "id" will be used. |
title.size |
An integer to specify the size of the title. |
axes.text.size |
An integer to specify the size of the axes characters. |
axes.lab.size |
An integer to specify the size of the axes labels. |
multiplot |
Logical. If TRUE (default), multiple plots are displayed on the same page. |
nrow |
An integer to specify the number of rows in the multiple plot page. |
ncol |
An integer to specify the number of columns in the multiple plot page. |
An arrangelist is returned when multiplot is TRUE. Otherwise a list is returned.
Takahiro Shimada
dupfilter
, ddfilter
, vmax
, vmaxlp
#### Load data sets ## Fastloc GPS data obtained from two green turtles data(turtle) data(turtle2) turtles<-rbind(turtle, turtle2) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtles, step.time=5/60, step.dist=0.001) #### ddfilter V <- vmax(turtle.dup) VLP <- vmaxlp(turtle.dup) turtle.dd <- ddfilter(turtle.dup, vmax=V, vmaxlp=VLP) #### Plot filtered data for each animal ## using the low-resolution world map to_map(turtle.dd, point.size = 2, line.size = 0.5, axes.lab.size = 0, ncol=2, nrow=1) ## Not run: ## using the high-resolution google satellite images to_map(turtle.dd, bgmap = "satellite", google.key = "key", ncol=2) ## End(Not run)
#### Load data sets ## Fastloc GPS data obtained from two green turtles data(turtle) data(turtle2) turtles<-rbind(turtle, turtle2) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtles, step.time=5/60, step.dist=0.001) #### ddfilter V <- vmax(turtle.dup) VLP <- vmaxlp(turtle.dup) turtle.dd <- ddfilter(turtle.dup, vmax=V, vmaxlp=VLP) #### Plot filtered data for each animal ## using the low-resolution world map to_map(turtle.dd, point.size = 2, line.size = 0.5, axes.lab.size = 0, ncol=2, nrow=1) ## Not run: ## using the high-resolution google satellite images to_map(turtle.dd, bgmap = "satellite", google.key = "key", ncol=2) ## End(Not run)
Calculate time, distance, speed, and inner angle between successive locations
track_param( sdata, param = c("time", "distance", "speed", "angle", "mean speed", "mean angle"), days = 2 )
track_param( sdata, param = c("time", "distance", "speed", "angle", "mean speed", "mean angle"), days = 2 )
sdata |
A data.frame or a list of data.frames containing columns with the following headers: "id", "DateTime", "lat", "lon".
The function calculates each movement parameter by a unique "id" (e.g. transmitter number, identifier for each animal)
if the input is a data.frame, or by each element of the list if the input is a list.
"DateTime" is the GMT date & time of each location in class |
param |
A string or vector specifying movement parameters to be calculated. Options are 'time', 'distance', 'speed', 'angle', 'mean speed' and 'mean angle'. See details. |
days |
A numeric value specifying the number of days to calculate mean speeds and angles. This argument is only used when 'mean speed' and/or 'mean angle' are selected in param. |
This function calculates various parameters of tracks. time (h), distance (km), speed (km/h) and inner angle (degrees) are calculated from each pair of successive locations. mean speed (km/h) and angle (degrees) are calculated from locations over a specified number of days.
The input data is returned with new columns containing the requested parameters. "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively. "pSpeed" and "sSpeed" are linear speed (km/h) from a previous and to a subsequent fix respectively. "inAng" is the degree between the bearings of lines joining successive location points. "meanSpeed" and "meanAngle" are the mean speed and degree over a specified number of days.
Takahiro Shimada
#### Load turtle tracking data data(turtle) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=5/60, step.dist=0.001) #### ddfilter turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, vmaxlp=2.0) #### Mean speed over 2 days mean.speed <- track_param(turtle.dd, param = c('speed', 'mean speed'), days=2) #### Plot data ggplot(data = mean.speed, aes(x=lon, y=lat)) + geom_path(colour = 'grey') + geom_point(aes(colour=meanSpeed))
#### Load turtle tracking data data(turtle) #### Filter temporal and/or spatial duplicates turtle.dup <- dupfilter(turtle, step.time=5/60, step.dist=0.001) #### ddfilter turtle.dd <- ddfilter(turtle.dup, vmax=9.9, qi=4, ia=90, vmaxlp=2.0) #### Mean speed over 2 days mean.speed <- track_param(turtle.dd, param = c('speed', 'mean speed'), days=2) #### Plot data ggplot(data = mean.speed, aes(x=lon, y=lat)) + geom_path(colour = 'grey') + geom_point(aes(colour=meanSpeed))
A dataset containing Fastloc GPS locations of a green turtle tracked in Sandy Strait, Australia.
turtle
turtle
A data frame with 429 rows and 5 variables:
identifier for each animal.
GMT date & time of each location in class POSIXct
.
latitude in decimal degrees.
longitude in decimal degrees.
quality index associated with each location fix. The input values can be either the number of GPS satellites or Argos Location Classes. Argos Location Classes will be converted to numerical values, where "A", "B", "Z" will be replaced with "-1", "-2", "-3" respectively. The greater number indicates a higher accuracy.
Shimada T, Jones R, Limpus C, Groom R, Hamann M (2016) Long-term and seasonal patterns of sea turtle home ranges in warm coastal foraging habitats: Implications for conservation. Marine Ecology Progress Series 562:163-179. doi:10.3354/meps11972
A dataset containing Fastloc GPS locations of a green turtle tracked in Moreton Bay, Australia.
turtle2
turtle2
A data frame with 276 rows and 5 variables:
identifier for each animal.
GMT date & time of each location in class POSIXct
.
latitude in decimal degrees.
longitude in decimal degrees.
quality index associated with each location fix. The input values can be either the number of GPS satellites or Argos Location Classes. Argos Location Classes will be converted to numerical values, where "A", "B", "Z" will be replaced with "-1", "-2", "-3" respectively. The greater number indicates a higher accuracy.
Shimada T, Jones R, Limpus C, Groom R, Hamann M (2016) Long-term and seasonal patterns of sea turtle home ranges in warm coastal foraging habitats: Implications for conservation. Marine Ecology Progress Series 562:163-179. doi:10.3354/meps11972
Inter-nesting utilisation distributions of 15 flatback turtles (Natator depressus) that nested in Curtis Island, Australia.
The UDs were calculated using the sample tracking data flatback
and reduced grid resolution (1 km)
instead of 50m as used in Shimada et al. (2021).
See GitHub for an example code of UD estimation.
ud_matrix
ud_matrix
A matrix
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Inter-nesting utilisation distributions of 15 flatback turtles (Natator depressus) that nested in Curtis Island, Australia.
The UDs were calculated using the sample tracking data flatback
and reduced grid resolution (1 km)
instead of 50m as used in Shimada et al. (2021).
See GitHub for an example code of UD estimation.
ud_raster
ud_raster
A list of 15 stars objects
Shimada T, Thums M, Hamann M, Limpus CJ, Hays GC, FitzSimmons N, Wildermann NE, Duarte CD, Meekan MG (2021) Optimising sample sizes for animal distribution analysis using tracking data. Methods in Ecology and Evolution 12(2):288-297 doi:10.1111/2041-210X.13506
Function to estimate the maximum linear speed between two consecutive locations.
vmax(sdata, qi = 5, method = "ML", prob = 0.99, ...)
vmax(sdata, qi = 5, method = "ML", prob = 0.99, ...)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
qi |
An integer specifying the lowest quality index of a location that is qualified to be used in the estimation. Default is 5 (e.g. 5 GPS satellite or more). |
method |
Available options are "sample" (i.e. sample quantile - see |
prob |
A value (0 to 1) specifying the sample quantile or cumulative probability for linear speed. Values beyond this threshold are considered 'outliers' and excluded from estimation of maximum linear speed. Default is 0.99. See details. |
... |
Extra arguments passed to |
The function first calculates the linear speed between each pair of two consecutive locations.
Some of the calculated linear speed can be inaccurate when the input data contains inaccurate locations (e.g. outliers).
The function can discard the implausible outliers by excluding extreme values using either the "sample" or "ML" method.
The "sample" method simply discards values that lie beyond the specified quantile.
If the "ML" method is selected, it is assumed that the linear speed follow a Gamma distribution.
The distribution parameters are derived via maximum likelihood estimation using the optim
function.
The linear speed at the given quantile or cumulative probability (e.g. 0.99) represents the maximum linear speed at which
an animal would travel between two consecutive locations.
Maximum linear speed (vmax) estimated from the input data. The unit is km/h.
Takahiro Shimada
Shimada T, Jones R, Limpus C, Hamann M (2012) Improving data retention and home range estimates by data-driven screening. Marine Ecology Progress Series 457:171-180 doi:10.3354/meps09747
ddfilter
, ddfilter_speed
, track_param
, dupfilter
Function to estimate the maximum one-way linear speed of a loop trip.
vmaxlp(sdata, qi = 4, nloc = 5, method = "ML", prob = 0.99, ...)
vmaxlp(sdata, qi = 4, nloc = 5, method = "ML", prob = 0.99, ...)
sdata |
A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi".
See the data |
qi |
An integer specifying the minimum quality index associated with a location used for the estimation. Default is 4 (e.g. 4 GPS satellite or more). |
nloc |
An integer specifying the minimum number of successive locations to be considered a loop trip. |
method |
Available options are "sample" (i.e. sample quantile - see |
prob |
A value (0 to 1) specifying the sample quantile or cumulative probability for one-way linear speed of a loop trip. Values beyond this threshold are considered 'outliers' and excluded from estimation of maximum one-way linear speed of a loop trip. Default is 0.99. See details. |
... |
Extra arguments passed to |
The function first detects a "loop trip".
Loop trip behaviour is represented by spatial departure and return involving more than 3 consecutive locations
(Shimada et al. 2012).
The function calculates the net (i.e. straight-line) distance between the departure and turning point as well as
the turning point and return location of a loop trip.
It then calculates the one-way travelling speed to or from each turning point for each loop trip.
To exclude implausible outliers, the function discards extreme values based on the specified quantile or
an estimated probability distribution for the loop trip speed, depending on the selected method.
If the "ML" method is selected, a Gamma distribution is assumed and the shape and scale parameters are estimated via maximum likelihood estimation
using the optim
function.
The maximum value within a given quantile or probability range (e.g. 0.99) represents the maximum one-way linear speed at which
an animal would travel during a loop trip.
Maximum one-way linear speed of a loop trip (vmaxlp) estimated from the input data. The unit km/h.
The input data must not contain temporal or spatial duplicates. A minimum of 8 locations are required.
Takahiro Shimada
Shimada T, Jones R, Limpus C, Hamann M (2012) Improving data retention and home range estimates by data-driven screening. Marine Ecology Progress Series 457:171-180 doi:10.3354/meps09747
ddfilter
, ddfilter_loop
, track_param
, dupfilter