-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutlier-locs.qmd
More file actions
55 lines (44 loc) · 1.53 KB
/
Copy pathoutlier-locs.qmd
File metadata and controls
55 lines (44 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "Removing Outlier Locations"
---
```{r}
#| include: false
akbs_locs <- readRDS(here::here("shared_cache","akbs_locs.rds"))
```
## Filtering Obviously Wrong Locations
Location estimates from bio-loggers can sometimes provide extremely
erroneous locations. This is especially true for the Argos system and the error
estimates provided do not provide a realistic mechanism for removal (e.g.
remove all locations with an error estimate above some threshold). If these
extreme outliers are not removed from the data set prior to model fitting,
issues with model convergence or other errors can arise.
## Speed, Distance, and Angle Filtering
To identify and remove these obviously erroneous observations we will rely
on a speed, distance, and angle filter from the `trip` package to identify locations
that would require traveling speeds that exceed 2x or more what would be
expected from the study species. In our case, with bearded seals, we'll
use 7.5m/second (the likely maximum sustained speed for a bearded seal is
2.5m/second).
```{r}
#| message: false
#| warning: false
library(dplyr)
library(sf)
library(trip)
dat <- akbs_locs %>%
ungroup() %>%
arrange(deploy_id, date)
dat_tr <- trip(dat, c("date","deploy_id"), correct_all = FALSE)
keep <- sda(
dat_tr,
smax = 27 #km/hour or 7.5m/sec *3.6
)
akbs_locs <- dat %>%
mutate(sda_keep = keep) %>%
filter(sda_keep) %>%
dplyr::select(-sda_keep)
```
```{r}
#| include: false
saveRDS(akbs_locs, file = here::here("shared_cache","akbs_locs_filt.rds"))
```