Skip to content

Commit

Permalink
set eval=FALSE where possible to speed-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Jonsen committed Jan 11, 2024
1 parent df94312 commit 76054f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vignettes/Mapping.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fit <- fit_ssm(se2,
map(fit, what = "predicted")
```

```{r map 1a, echo=FALSE, fig.height=4, fig.width=7, warning=FALSE, message=FALSE}
```{r map 1a, eval=FALSE, echo=FALSE, fig.height=4, fig.width=7, warning=FALSE, message=FALSE}
se2 <- subset(sese, id %in% unique(id)[1:2])
fit <- fit_ssm(se2,
model = "mp",
Expand Down
6 changes: 3 additions & 3 deletions vignettes/Move_persistence_models.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require(aniMotum)
require(ggplot2)
```
`aniMotum` provides a few different ways to fit a move persistence model to obtain estimates of a continuous-valued behavioural index along individual tracks (Auger-Méthé et al. 2017; Jonsen et al. 2019). In `aniMotum` versions prior to 1.0-5, move persistence was estimated via `fit_mpm()` and, when fitting to Argos or other location error-prone data types, required a two-stage approach of first calling `fit_ssm()` and then calling `fit_mpm()`. The first step fits a state-space model to account for location error in the data:
```{r fit ssm, warning=FALSE, message=FALSE}
```{r fit ssm, eval=FALSE, warning=FALSE, message=FALSE}
d <- subset(sese, id == "ct109-186-14")
fit <- fit_ssm(d,
vmax = 3,
Expand All @@ -26,7 +26,7 @@ fit <- fit_ssm(d,
```

The second step estimates move persistence from the SSM-estimated locations:
```{r fit mpm, warning=FALSE, message=FALSE}
```{r fit mpm, eval=FALSE, warning=FALSE, message=FALSE}
fmp <- fit_mpm(fit,
what = "predicted",
model = "mpm",
Expand All @@ -48,7 +48,7 @@ map(fit, fmp, what = "predicted", silent = TRUE)
`aniMotum` now provides a move persistence model in state-space form to allow simultaneous estimation of move persistence and location states, and this is invoked via `fit_ssm()` by specifying `model = "mp"`. Currently, this model can only be fit to individuals separately.

Here, we fit the move persistence SSM to the same southern elephant seal track as above:
```{r fit_ssm, warning=FALSE, message=FALSE}
```{r fit_ssm, eval=FALSE, warning=FALSE, message=FALSE}
fit <- fit_ssm(d,
vmax = 3,
model = "mp",
Expand Down
2 changes: 1 addition & 1 deletion vignettes/SSM_fitting.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Fitting SSM's to tracking data in `aniMotum` is intended to be as simple as poss
4. using [`trip::sda`](https://CRAN.R-project.org/package=trip) to identify potentially extreme observations based on speed, distance, and angle (Freitas et al. 2008).

Several arguments to `fit_ssm` provide a measure of control over data processing. The `vmax`, `ang` and `distlim` arguments provide control over the `trip::sda` filter (see `?fit_ssm` for details). The `sda` filter can occasionally fail (possibly when calculating angles between successive displacements), in this case we fall back to using `trip::speedfilter` and a warning issued. The `trip` filter can be turned off altogether with `spdf = FALSE`, although this is usually not advisable if working with older Least-Squares Argos data, the lower prevalence of extreme observations in newer Kalman filtered Argos data may not always require speed-filtering prior to fitting an SSM. The minimum time interval allowed between observations is set by `min.dt`. Finally, the processed data can be returned, e.g. for careful inspection, without fitting an SSM with the `pf = TRUE` argument:
```{r pre-processing, message=FALSE}
```{r pre-processing, eval=FALSE, message=FALSE}
fit_ssm(ellie,
vmax = 3,
pf = TRUE)
Expand Down

0 comments on commit 76054f0

Please sign in to comment.