### Example: fit_ssm, sim_post, and plot Source: https://ianjonsen.github.io/aniMotum/reference/plot.sim_post.html Example workflow: fits a correlated random walk SSM to the 'ellie' dataset, simulates posterior tracks with sim_post, and plots them as lines. The output from fit_ssm is shown as comments. ```r fit <- fit_ssm(ellie, model = "crw", time.step = 24) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -2.91153 pars: 0.38512 0.37191 -0.01692 -3.38813 pars: -1.4595 -1.51236 -0.06769 -4.81792 pars: -2.20058 -2.24383 -0.11527 -4.95732 pars: -0.38346 -0.4056 -0.04615 -3.85456 pars: -1.23664 -1.20844 -0.10327 -3.65984 pars: -2.25711 -2.16871 -0.17159 -3.42693 pars: -3.07868 -3.34599 -0.26131 -1.24778 pars: -4.46619 -1.62751 -0.49092 0.12579 pars: -3.18442 -2.86245 -0.30197 -0.80151 pars: -3.40955 -3.30581 -0.49919 -0.40195 pars: -3.06893 -3.16418 -1.05454 -0.36585 pars: -3.5513 -2.81435 -1.34642 -0.44033 pars: -3.30092 -3.01944 -1.10395 -0.39263 pars: -3.27833 -3.03821 -1.38152 -0.39631 pars: -3.23173 -2.97174 -2.21731 -0.40477 pars: -3.28771 -3.08271 -5.28966 -0.34232 pars: -3.30222 -3.07091 -5.31779 -0.38305 pars: -3.30222 -3.07091 -5.31779 -0.38305 psim <- sim_post(fit, what = "p", reps = 10) plot(psim, type = "lines") ``` -------------------------------- ### Example: fit_ssm and sim_fit usage Source: https://ianjonsen.github.io/aniMotum/reference/sim_fit.html Example showing how to fit an SSM to the ellie dataset and then simulate predicted tracks with sim_fit. The output includes the fitting progress messages and the final plot call. ```r fit <- fit_ssm(ellie, model = "crw", time.step = 24) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -2.91153 pars: 0.38512 0.37191 -0.01692 -3.38813 pars: -1.4595 -1.51236 -0.06769 -4.81792 pars: -2.20058 -2.24383 -0.11527 -4.95732 pars: -0.38346 -0.4056 -0.04615 -3.85456 pars: -1.23664 -1.20844 -0.10327 -3.65984 pars: -2.25711 -2.16871 -0.17159 -3.42693 pars: -3.07868 -3.34599 -0.26131 -1.24778 pars: -4.46619 -1.62751 -0.49092 0.12579 pars: -3.18442 -2.86245 -0.30197 -0.80151 pars: -3.40955 -3.30581 -0.49919 -0.40195 pars: -3.06893 -3.16418 -1.05454 -0.36585 pars: -3.5513 -2.81435 -1.34642 -0.44033 pars: -3.30092 -3.01944 -1.10395 -0.39263 pars: -3.27833 -3.03821 -1.38152 -0.39631 pars: -3.23173 -2.97174 -2.21731 -0.40477 pars: -3.28771 -3.08271 -5.28966 -0.34232 pars: -3.30222 -3.07091 -5.31779 -0.38305 pars: -3.30222 -3.07091 -5.31779 -0.38305 trs <- sim_fit(fit, what = "predicted", reps = 3) plot(trs) ``` -------------------------------- ### Create ssm fit object for print example Source: https://ianjonsen.github.io/aniMotum/reference/print.ssm.html Generate an ssm fit object for the example. Uses the ellie dataset with a random walk model and 24-hour time step. ```R xs <- fit_ssm(ellie, spdf=FALSE, model = "rw", time.step=24, control = ssm_control(se = FALSE, verbose = 0)) ``` -------------------------------- ### Example: fit_ssm and osar usage Source: https://ianjonsen.github.io/aniMotum/reference/osar.html Example showing how to generate a ssm fit object and then calculate one-step-ahead residuals with osar. The fit_ssm call is for speed only. ```r # generate a ssm fit object (call is for speed only) xs <- fit_ssm(ellie, spdf=FALSE, model = "rw", time.step=24, control = ssm_control(verbose = 0)) #> res <- osar(xs) ``` -------------------------------- ### Example: fit, simulate, and plot tracks Source: https://ianjonsen.github.io/aniMotum/reference/plot.sim_fit.html Example workflow: fits a correlated random walk SSM to the 'ellie' dataset with a 24-hour time step, simulates tracks from the fitted model using 'sim_fit' with what='p' and 2 replicates, then plots the simulated tracks. The fitting output shows progress lines from the optimizer. ```r fit <- fit_ssm(ellie, model = "crw", time.step = 24) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -2.91153 pars: 0.38512 0.37191 -0.01692 -3.38813 pars: -1.4595 -1.51236 -0.06769 -4.81792 pars: -2.20058 -2.24383 -0.11527 -4.95732 pars: -0.38346 -0.4056 -0.04615 -3.85456 pars: -1.23664 -1.20844 -0.10327 -3.65984 pars: -2.25711 -2.16871 -0.17159 -3.42693 pars: -3.07868 -3.34599 -0.26131 -1.24778 pars: -4.46619 -1.62751 -0.49092 0.12579 pars: -3.18442 -2.86245 -0.30197 -0.80151 pars: -3.40955 -3.30581 -0.49919 -0.40195 pars: -3.06893 -3.16418 -1.05454 -0.36585 pars: -3.5513 -2.81435 -1.34642 -0.44033 pars: -3.30092 -3.01944 -1.10395 -0.39263 pars: -3.27833 -3.03821 -1.38152 -0.39631 pars: -3.23173 -2.97174 -2.21731 -0.40477 pars: -3.28771 -3.08271 -5.28966 -0.34232 pars: -3.30222 -3.07091 -5.31779 -0.38305 pars: -3.30222 -3.07091 -5.31779 -0.38305 trs <- sim_fit(fit, what = "p", reps = 2) plot(trs) ``` -------------------------------- ### Install aniMotum binary from local file Source: https://ianjonsen.github.io/aniMotum/index.html Installs a manually downloaded binary version of aniMotum on Windows or Mac. Replace path_to_file with the actual location of the downloaded file. On Mac, the file must have a .tgz extension, not .tar. ```r # for Windows install.packages("path_to_file\aniMotum_1.2-06.zip", repos=NULL, type="win.binary", dependencies = TRUE) # for Mac install.packages("path_to_file/aniMotum_1.2-06.tgz", repos=NULL, type="mac.binary", dependencies = TRUE) ``` -------------------------------- ### smru_haulout usage examples with fit_ssm Source: https://ianjonsen.github.io/aniMotum/reference/smru_haulout.html Example usage of smru_haulout and fit_ssm. It shows three ways to add the haulout indicator: calling smru_haulout directly before fitting, passing the haulout file path to fit_ssm's haulout argument, and pre-reading/filtering the haulout file before passing it. The final example demonstrates using id_fun to transform IDs when naming conventions differ between files. The code is wrapped in \dontrun and is not executed. ```r if (FALSE) { # \dontrun{ ## called directly - add ho before fitting d <- read.csv("my_tracks.csv") d <- smru_haulout(d, "haulout_ct189.csv") fit <- fit_ssm(d, model = "mp", time.step = 24, control = ssm_control(ho_scale = 0.01, verbose = 0)) ## called via fit_ssm haulout argument - equivalent to above fit <- fit_ssm(d, model = "mp", time.step = 24, haulout = "haulout_ct189.csv", control = ssm_control(ho_scale = 0.01, verbose = 0)) ## pre-read and filter the haulout file before passing to fit_ssm ho_raw <- read.csv("haulout_ct189.csv") ho_raw <- subset(ho_raw, cid == "ct189") fit <- fit_ssm(d, model = "mp", time.step = 24, haulout = ho_raw, control = ssm_control(ho_scale = 0.01, verbose = 0)) ## IDs differ between files: haulout uses "ct189-576-25", ## tracking data uses "ct189_576_25" d <- smru_haulout(d, "haulout_ct189.csv", id_fun = function(x) gsub("-", "_", x)) } # } ``` -------------------------------- ### Example: fit SSM and MPM, then plot Source: https://ianjonsen.github.io/aniMotum/reference/plot.mpm_df.html Workflow example: fit an SSM (for speed only), fit an MPM, then plot the 1-D MPM time series on a single page. The fit_ssm call uses spdf=FALSE, model='rw', time.step=72, and ssm_control(verbose=0). The fit_mpm call uses model='jmpm' and prints fitting progress. The plot call uses pages=1. ```r # generate a ssm fit object (call is for speed only) xs <- fit_ssm(sese2, spdf=FALSE, model = "rw", time.step=72, control = ssm_control(verbose = 0)) #> #> # fit mpm to ssm fits xm <- fit_mpm(xs, model = "jmpm") #> fitting jmpm... #> pars: 0 0 0 pars: -0.63038 -0.77416 0.05745 pars: -0.21961 -0.90381 0.95993 pars: 0.1024 -0.34798 0.19353 pars: -0.12912 -0.74761 0.74455 pars: -0.17853 -0.8329 0.86216 pars: -0.23363 -0.801 0.86597 pars: -0.27635 -0.61987 0.76146 pars: -0.40458 -0.79384 0.62587 pars: -0.36412 -0.6719 0.40545 pars: -0.38583 -0.70377 0.60569 pars: -0.43697 -0.67572 0.577 pars: -0.38583 -0.70377 0.60569 # plot 1-D mp timeseries on 1 page plot(xm, pages = 1) ``` -------------------------------- ### Example: fit_ssm with ssm_control using nlminb Source: https://ianjonsen.github.io/aniMotum/reference/ssm_control.html Shows how to pass ssm_control to fit_ssm, specifying the nlminb optimizer and setting eval.max to 2000. The output shows the fitting progress with parameter traces. ```R fit <- fit_ssm(ellie, vmax = 4, model = "crw", time.step = 72, control = ssm_control( optim = "nlminb", eval.max = 2000) ) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -3.35398 pars: 0.39011 0.36995 -0.01715 -3.83437 pars: -1.43958 -1.5202 -0.06862 -5.27553 pars: -2.32555 -2.54729 -0.19371 -4.12372 pars: -0.8182 -0.89535 -0.06643 -4.50381 pars: -1.32518 -1.50336 -0.13293 -2.80663 pars: -2.70765 -2.68894 -0.23564 -2.37746 pars: -3.27563 -3.39761 -0.40156 -0.74674 pars: -4.54561 -2.25375 -0.86806 -0.13627 pars: -3.3297 -3.27793 -0.43777 -0.61077 pars: -3.36938 -3.29518 -0.51676 -0.44068 pars: -3.37129 -3.28379 -0.68713 -0.35188 pars: -3.37129 -3.28379 -0.68713 -0.35188 ``` -------------------------------- ### Example: fit SSM model and filter simulations Source: https://ianjonsen.github.io/aniMotum/reference/sim_filter.html Complete example workflow: fit a crw SSM to Argos LS data, generate 5 simulated paths, filter to top 40% of flag values, and compare unfiltered and filtered paths with a plot. The plot comparison is wrapped in \donttest{}. ```r ## fit crw model to Argos LS data fit <- fit_ssm(ellie, model = "crw", time.step = 72) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -3.35398 pars: 0.39011 0.36995 -0.01715 -3.83437 pars: -1.43958 -1.5202 -0.06862 -5.27553 pars: -2.32555 -2.54729 -0.19371 -4.12372 pars: -0.8182 -0.89535 -0.06643 -4.50381 pars: -1.32518 -1.50336 -0.13293 -2.80663 pars: -2.70765 -2.68894 -0.23564 -2.37746 pars: -3.27563 -3.39761 -0.40156 -0.74674 pars: -4.54561 -2.25375 -0.86806 -0.13627 pars: -3.3297 -3.27793 -0.43777 -0.61077 pars: -3.36938 -3.29518 -0.51676 -0.44068 pars: -3.37129 -3.28379 -0.68713 -0.35188 pars: -3.37129 -3.28379 -0.68713 -0.35188 set.seed(pi) ## generate 5 simulated paths from ssm fit trs <- sim_fit(fit, what = "predicted", reps = 5) ## filter simulations and keep paths in top 40% of flag values trs_f <- sim_filter(trs, keep = 0.4, flag = 2) ## compare unfiltered and filtered simulated paths # \donttest{ plot(trs) | plot(trs_f) # } ``` -------------------------------- ### Install aniMotum from R-Universe Source: https://ianjonsen.github.io/aniMotum/index.html Install aniMotum from the R-Universe repository. This installs all Imported and Suggested R packages from CRAN and R-universe. Answer 'Yes' if prompted to install the source version. First-time installation may take a while if dependent packages need to be compiled. ```R # install from my R-universe repository install.packages("aniMotum", repos = c("https://cloud.r-project.org", "https://ianjonsen.r-universe.dev"), dependencies = TRUE) ``` -------------------------------- ### Example: fit_ssm and grab predicted values Source: https://ianjonsen.github.io/aniMotum/reference/grab.html Example from the documentation: first generate an ssm fit object using fit_ssm on the ellie dataset, then grab predicted values as an un-projected tibble. The output of fit_ssm is not shown in the source. ```r ## generate an ssm fit object xs <- fit_ssm(ellie, spdf=FALSE, model = "rw", time.step=24, control = ssm_control(verbose = 0)) #> ## grab predicted values as an un-projected tibble preds <- grab(xs, what = "predicted") ``` -------------------------------- ### Install aniMotum from GitHub with remotes Source: https://ianjonsen.github.io/aniMotum/index.html Installs aniMotum from GitHub source using remotes. Requires proper compiler tools and libraries, such as Rtools on Windows and Xcode Command Line Tools plus a Gnu Fortran compiler on Mac. ```r remotes::install_github("ianjonsen/aniMotum") ``` -------------------------------- ### Example: fit ssm and mpm models, then join predicted values Source: https://ianjonsen.github.io/aniMotum/reference/join.html Complete example from the documentation: loads example aniMotum fit objects, fits an ssm model, fits an mpm model, then joins the predicted values into an un-projected tibble. The output shows the resulting tibble structure with columns including id, date, lon, lat, x, y, x.se, y.se, gap_flag, logit_g, logit_g.se, and g. ```r ## load example aniMotum fit objects (to save time) ## generate a ssm fit object xs <- fit_ssm(ellie, spdf=FALSE, model = "rw", time.step=24, control = ssm_control(verbose = 0)) #> xm <- fit_mpm(xs, what = "p", model = "mpm") #> fitting mpm... #> pars: 0 0 0 pars: -0.65944 -0.75114 -0.03049 pars: -2.63775 -3.00457 -0.12194 pars: -2.73937 -4.15687 -0.30416 pars: -0.86743 -1.09171 -0.05785 pars: -1.18976 -1.82073 -0.12602 pars: -0.8491 -2.52724 -0.28347 pars: -1.13954 -1.92487 -0.14923 pars: -1.13979 -1.98651 -0.24977 pars: -1.12989 -1.92935 -0.35244 pars: -1.12789 -1.95509 -0.46751 pars: -1.12669 -1.93037 -0.58281 pars: -1.12848 -1.92558 -0.81238 pars: -1.12944 -1.87726 -1.377 pars: -0.809 -1.84174 -2.25192 pars: -1.0756 -1.9101 -1.45917 pars: -1.1263 -1.96239 -1.53282 pars: -1.1094 -1.91349 -1.46293 pars: -1.1047 -1.90968 -1.49657 pars: -1.10821 -1.90297 -1.55182 pars: -1.1032 -1.91244 -1.6407 pars: -1.10231 -1.91103 -1.70906 pars: -1.10231 -1.91103 -1.70906 ## join predicted values as an un-projected tibble xsm <- join(xs, xm) xsm #> # A tibble: 113 × 12 #> id date lon lat x y x.se y.se gap_flag #> #> 1 54591 2012-03-05 05:00:00 111. -66.4 12309. -9956. 1.38 1.44 0 #> 2 54591 2012-03-06 05:00:00 110. -66.4 12287. -9947. 25.6 0.419 0 #> 3 54591 2012-03-07 05:00:00 110. -66.5 12298. -9963. 4.48 2.47 0 #> 4 54591 2012-03-08 05:00:00 110. -66.4 12288. -9949. 32.7 28.8 0 #> 5 54591 2012-03-09 05:00:00 110. -66.5 12299. -9972. 9.07 2.55 0 #> 6 54591 2012-03-10 05:00:00 111. -66.4 12302. -9958. 21.3 18.6 0 #> 7 54591 2012-03-11 05:00:00 111. -66.5 12323. -9967. 22.3 19.6 0 #> 8 54591 2012-03-12 05:00:00 110. -66.5 12287. -9962. 28.2 9.78 0 #> 9 54591 2012-03-13 05:00:00 110. -66.4 12288. -9950. 35.4 31.1 0 #> 10 54591 2012-03-14 05:00:00 110. -66.4 12291. -9938. 32.8 28.9 0 #> # ℹ 103 more rows #> # ℹ 3 more variables: logit_g , logit_g.se , g ``` -------------------------------- ### Example: generate osar residuals and plot QQ Source: https://ianjonsen.github.io/aniMotum/reference/plot.osar.html Fits a random walk SSM to the ellie dataset, computes one-step-ahead residuals with osar(), then plots the QQ residuals. The fit_ssm call is speed-optimized with se=FALSE and verbose=0. ```r ## generate a fG_ssm fit object (call is for speed only) xs <- fit_ssm(ellie, spdf=FALSE, model = "rw", time.step=24, control = ssm_control(se = FALSE, verbose = 0)) #> res <- osar(xs) plot(res, type = "qq") ``` -------------------------------- ### Example: fit_ssm and plot fitted locations Source: https://ianjonsen.github.io/aniMotum/reference/plot.ssm_df.html Fits a random walk model to the sese2 dataset (for speed) and plots fitted locations as 1-D time series on a single page. The fit_ssm call uses control = ssm_control(verbose = 0) to suppress output. ```r ## generate a ssm fit object (call is for speed only) xs <- fit_ssm(sese2, spdf=FALSE, model = "rw", time.step=72, control = ssm_control(verbose = 0)) #> #> # plot fitted locations as 1-D timeseries on 1 page plot(xs, what = "f", pages = 1) ``` -------------------------------- ### sim_fit(x, what, reps, start, end, grad, beta, cpf, sim_only) Source: https://ianjonsen.github.io/aniMotum/reference/sim_fit.html Simulates animal tracks from a fitted SSM object using the rw or crw process models. Returns a fG_sim_fit object containing the simulated paths. ```APIDOC ## sim_fit(x, what, reps, start, end, grad, beta, cpf, sim_only) ### Description Simulates animal tracks from a fitted SSM object using the rw or crw process models. Returns a fG_sim_fit object containing the simulated paths. ### Method Function call ### Endpoint sim_fit(x, what = c("fitted", "predicted"), reps = 1, start = NULL, end = NULL, grad = NULL, beta = c(-300, -300), cpf = FALSE, sim_only = FALSE) ### Parameters #### Arguments - **x** (ssm fit object) - Required - A `ssm` fit object with class `ssm_df`. - **what** (character) - Optional - Simulate fitted (typically irregular in time) or predicted (typically regular in time) locations. Default is c("fitted", "predicted"). - **reps** (numeric) - Optional - Number of replicate tracks to simulate from an `ssm` model fit object. Default is 1. - **start** (numeric vector) - Optional - A 2-element vector for the simulated track start location (lon,lat or x,y). Default is NULL. - **end** (numeric vector) - Optional - A 2-element vector for the simulated track end location (lon,lat or x,y). Default is NULL. - **grad** (SpatRaster) - Optional - A SpatRaster of x- and y-gradients as separate layers (see details). Default is NULL. - **beta** (numeric vector) - Optional - A 2-element vector of parameters defining the potential function magnitude in x- and y-directions (ignored if `is.null(grad)`, ie. no potential function; see details). Default is c(-300, -300). - **cpf** (logical) - Optional - Should simulated tracks return to their start point (ie. a central-place forager). Default is FALSE. - **sim_only** (logical) - Optional - Do not include `ssm` estimated location in output (default is FALSE). Default is FALSE. ### Value A `fG_sim_fit` object containing the paths simulated from a `ssm` fit object. ### Details A potential function can be applied to the simulated paths to help avoid locations on land (or in water), using the `grad` and `beta` arguments. A coarse-resolution rasterStack of global x- and y-gradients of distance to land are provided. Stronger beta parameters result in stronger land (water) avoidance but may also introduce undesirable/unrealistic artefacts (zig-zags) in the simulated paths. See Brillinger et al. (2012) and `vignette("momentuHMM", package = "momentuHMM")` for more details on the use of potential functions for simulating constrained animal movements. WARNING: This application of potential functions to constrain simulated paths is experimental, likely to change in future releases, and NOT guaranteed to work enitrely as intended, especially if `cpf = TRUE`! ### References Brillinger DR, Preisler HK, Ager AA, Kie J (2012) The use of potential functions in modelling animal movement. In: Guttorp P., Brillinger D. (eds) Selected Works of David Brillinger. Selected Works in Probability and Statistics. Springer, New York. pp. 385-409. ### Examples ```r fit <- fit_ssm(ellie, model = "crw", time.step = 24) #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -2.91153 pars: 0.38512 0.37191 -0.01692 -3.38813 pars: -1.4595 -1.51236 -0.06769 -4.81792 pars: -2.20058 -2.24383 -0.11527 -4.95732 pars: -0.38346 -0.4056 -0.04615 -3.85456 pars: -1.23664 -1.20844 -0.10327 -3.65984 pars: -2.25711 -2.16871 -0.17159 -3.42693 pars: -3.07868 -3.34599 -0.26131 -1.24778 pars: -4.46619 -1.62751 -0.49092 0.12579 pars: -3.18442 -2.86245 -0.30197 -0.80151 pars: -3.40955 -3.30581 -0.49919 -0.40195 pars: -3.06893 -3.16418 -1.05454 -0.36585 pars: -3.5513 -2.81435 -1.34642 -0.44033 pars: -3.30092 -3.01944 -1.10395 -0.39263 pars: -3.27833 -3.03821 -1.38152 -0.39631 pars: -3.23173 -2.97174 -2.21731 -0.40477 pars: -3.28771 -3.08271 -5.28966 -0.34232 pars: -3.30222 -3.07091 -5.31779 -0.38305 pars: -3.30222 -3.07091 -5.31779 -0.38305 trs <- sim_fit(fit, what = "predicted", reps = 3) plot(trs) ``` ``` -------------------------------- ### Re-route predicted locations with route_path Source: https://ianjonsen.github.io/aniMotum/reference/route_path.html Example usage of route_path on a fitted ssm object. It first checks that pathroutr is installed, fits a correlated random walk model to the ellie dataset, re-routes the predicted locations, and extracts the re-routed path with grab. The output shows the fitting progress and a tibble of re-routed locations. ```R # if 'pathroutr' is installed then ok to use route_path() if(requireNamespace("pathroutr", quietly = TRUE)) { fit <- fit_ssm(ellie, vmax = 4, model = "crw", time.step = 24) fit <- route_path(fit, what = "predicted") grab(fit, what = "rerouted") } #> fitting crw SSM to 1 tracks... #> pars: 1 1 0 -2.91153 pars: 0.38512 0.37191 -0.01692 -3.38813 pars: -1.4595 -1.51236 -0.06769 -4.81792 pars: -2.20058 -2.24383 -0.11527 -4.95732 pars: -0.38346 -0.4056 -0.04615 -3.85456 pars: -1.23664 -1.20844 -0.10327 -3.65984 pars: -2.25711 -2.16871 -0.17159 -3.42693 pars: -3.07868 -3.34599 -0.26131 -1.24778 pars: -4.46619 -1.62751 -0.49092 0.12579 pars: -3.18442 -2.86245 -0.30197 -0.80151 pars: -3.40955 -3.30581 -0.49919 -0.40195 pars: -3.06893 -3.16418 -1.05454 -0.36585 pars: -3.5513 -2.81435 -1.34642 -0.44033 pars: -3.30092 -3.01944 -1.10395 -0.39263 pars: -3.27833 -3.03821 -1.38152 -0.39631 pars: -3.23173 -2.97174 -2.21731 -0.40477 pars: -3.28771 -3.08271 -5.28966 -0.34232 pars: -3.30222 -3.07091 -5.31779 -0.38305 pars: -3.30222 -3.07091 -5.31779 -0.38305 #> # A tibble: 108 × 8 #> id date lon lat x y x.se y.se #> #> 1 54591 2012-03-05 05:00:00 111. -66.4 12309. -9956. 0.00001000 0.00001000 #> 2 54591 2012-03-06 05:00:00 110. -66.4 12299. -9947. 17.4 0.00763 #> 3 54591 2012-03-07 05:00:00 110. -66.4 12296. -9956. 25.1 19.2 #> 4 54591 2012-03-08 05:00:00 110. -66.5 12298. -9970. 21.1 18.5 #> 5 54591 2012-03-09 05:00:00 110. -66.5 12300. -9972. 8.11 1.22 #> 6 54591 2012-03-10 05:00:00 110. -66.4 12300. -9955. 5.10 3.03 #> 7 54591 2012-03-11 05:00:00 110. -66.4 12292. -9958. 18.1 14.3 #> 8 54591 2012-03-12 05:00:00 110. -66.5 12285. -9962. 18.2 4.41 #> 9 54591 2012-03-13 05:00:00 110. -66.4 12287. -9952. 5.83 4.87 #> 10 54591 2012-03-14 05:00:00 110. -66.4 12291. -9939. 4.31 4.36 #> # ℹ 98 more rows ``` -------------------------------- ### Check R version with R.Version() Source: https://ianjonsen.github.io/aniMotum/index.html Check the installed R version to ensure it is at least 4.0.0 (preferably 4.2.0 or higher) before installing aniMotum. ```R R.Version() ``` -------------------------------- ### Use optim optimizer via ssm_control Source: https://ianjonsen.github.io/aniMotum/articles/SSM_fitting.html Shows how to select the 'optim' optimizer instead of the default 'nlminb' by passing a named list from ssm_control to the control argument of fit_ssm. ```r fit <- fit_ssm(ellie, model = "crw", time.step = 24, control = ssm_control(optim = "optim", verbose = 0)) ``` -------------------------------- ### join() function signature Source: https://ianjonsen.github.io/aniMotum/reference/join.html Shows the usage signature for `join()`, including all arguments and their defaults. Use this to understand the function's parameters before calling it. ```r join( ssm, mpm, what.ssm = "predicted", as_sf = FALSE, normalise = FALSE, group = FALSE ) ``` -------------------------------- ### Custom date color palette Source: https://ianjonsen.github.io/aniMotum/articles/Mapping.html Uses hcl.colors() to specify a new color palette for displaying date-along-track. The example uses the 'Plasma' palette with 100 colors. ```R map(fit, what = "p", aes = aes_lst(mp=FALSE, conf=FALSE, date_pal = hcl.colors(n=100, "Plasma")), by.date = TRUE, by.id=FALSE) ```