Predicting fine-scale distributions and emergent spatiotemporal patterns from temporally dynamic step selection simulations
Description
The code, data and R objects in this repository accompany a paper titled 'Predicting fine-scale distributions and emergent spatiotemporal patterns from temporally dynamic step selection simulations', which is published in Ecography with DOI: 10.1111/ecog.07421.
This repository is a snapshot of the GitHub repository: https://github.com/swforrest/dynamic_SSF_sims, which also has animations of temporally dynamic distributions.
In this paper we used harmonic terms to estimate temporally dynamic coefficients from step selection models, from which we simulated animal movement trajectories. The simulations with temporal dynamics gave informative hourly predictions of expected buffalo distribution (animations below), and also gave more accurate long-term predictions.
The R Markdown and accompanying knitted html files are numbered by the order of analysis, with an additional 'walkthrough' to build some intuition around fitting models with harmonic terms. In the bioRxiv_v3 folder there are scripts for estimating previous space use density using kernel density estimation with temporally-decaying weights, which are accompanied by a preprint of that version: https://www.biorxiv.org/content/10.1101/2024.03.19.585696v3?versioned=true. The memory process was not included in the models in the current version of the preprint, as the focus was to generate landscape-scale predictions, and the memory process is not required. For generating realistic geographic space use (i.e. home ranges) then the memory process helps to constrain the extent of the simulated animal's movement. To see the results of the simulations with the memory process view Version 3 of the bioRxiv preprint.
In this Zenodo folder, the data
folder contains the data used in the first script to generate random steps and sample from the covariates (which are included in the mapping
folder). All the code should run with just these two sets of inputs (buffalo.csv for GPS data and rasters of spatial covariates in the mapping folder).
The details of the inputs and outputs of each script are below.
Walkthrough script - DynSSF_Walkthrough_Harmonics_and_selection_surfaces.Rmd
This script is a walkthrough to build intuition around fitting models with harmonic interaction terms (harmonic regression)
Inputs
- Data file that contains random steps, sampled covariate values and KDE density at the end of each used and random step (when using memory parameters that were estimated for all individuals simultaneously)
- buffalo_popn_GvM_covs_ST_KDEmem1000_allOPTIM_10rs_2024-02-05.csv
Outputs
- Fitted model objects (2 pairs of harmonics as an example)
- model_twostep_2p_harms_dry.rds
Script 1 - DynamicSSF_1_step_generation.qmd
Generate a track object to sample random step lengths and turning angles, and sample covariate values at the end of each step.
Inputs
- Buffalo GPS data
- buffalo.csv
- spatial covariate rasters
- canopy_cover.tif
- ndvi_GEE_projected_watermask20230207.tif
- slope_raster.tif
- veg_herby.tif
Outputs
- Data file that contains random steps and sampled covariate values at the end of each used and random step
- buffalo_parametric_popn_covs_GvM_10rs_2024-09-04.csv
Script 2a/b - DynamicSSF_2a_Model_fit_dry_season.qmd/DynamicSSF_2b_Model_fit_wet_season.qmd
This script fits step selection models with varying numbers of harmonic terms to the buffalo's dry (a) or wet (b) season data.
Inputs
- Data file that contains random steps, sampled covariate values and KDE density at the end of each used and random step (when using memory parameters that were estimated for all individuals simultaneously)
- buffalo_parametric_popn_covs_GvM_10rs_2024-09-04.csv
Outputs
- Fitted model objects (0, 1, 2 or 3 pairs of harmonics)
- Tables of hourly coefficient values from fitted models
Script 3 - DynamicSSF_3_Simulating_trajectories.qmd
This script takes the hourly coefficients of the fitted models and simulates (dynamic) animal movement trajectories.
Inputs
- Tables of hourly coefficient values from fitted models (change the input file to change which model's coefficients are used to simulate trajectories)
- Spatial covariate rasters
- ndvi_GEE_projected_watermask20230207.tif
- canopy_cover.tif
- veg_herby.tif
- slope_raster.tif
Outputs
- Simulated data (animal movement trajectories)
Script 4a - DynamicSSF_4a_Aggregating_simulations.R
This script takes animal movement trajectories (observed and simulated), and calculates the landscape-scale prediction maps by aggregating the simulated locations into raster. We ran this script on the QUT HPC.
Script 4b - DynamicSSF_4b_Simulation_convergence.R
This script assesses the convergence of the simulated trajectories, to ensure that the landscape-scale prediction maps are stable. We ran this script on the QUT HPC.
Script 5 - DynamicSSF_5_Hourly_summaries.qmd
We calculate hourly summary statistics which we used to compare between the observed data and simulated data.
Inputs
- Simulated data (animal movement trajectories)
- Spatial covariate rasters
- ndvi_GEE_projected_watermask20230207.tif
- canopy_cover.tif
- veg_herby.tif
- slope_raster.tif
- Data file of buffalo GPS data that contains random steps and sampled covariate values
Outputs
- Hourly summary statistic values for observed and simulated data (with number of harmonics depending on which trajectories are read in)
Script 6 - DynamicSSF_6_Assessing_predictions.qmd
This script assesses the long-term and hourly prediction maps, and validates them against the observed buffalo data using the continuous Boyce index, which is appropriate for presence-only GPS data.
Inputs
- Prediction maps from the
DynamicSSF_4a_Aggregating_simulations.R
script.
Outputs
- Plots of the landscape-scale predictions for the late dry season (~ 4 months) and for each hour of the day.
- Validation results from the continuous Boyce index
For more details, don't hesitate to get in contact at scott.forrest@qut.edu.au.
Files
buffalo.csv
Files
(818.2 MB)
Name | Size | Download all |
---|---|---|
md5:37d50a37a0271f4b9ee8ba1707d1d8a8
|
16.8 MB | Preview Download |
md5:b8074544877ac0d78ae80fe24d6d109a
|
1.5 MB | Preview Download |
md5:b63f673a327b391bfa319574f5970f4f
|
222.0 kB | Preview Download |
md5:753f3523cd0ce9eebca2defe74be718a
|
9.8 MB | Download |
md5:8feb520dfb3c7c8c2194e0e6c2115d2d
|
11.4 kB | Download |
md5:5f975e23647c1ee4261796f66603e71d
|
18.4 MB | Download |
md5:0ac6103481559207bc1f5b3228c86dfd
|
98.3 kB | Download |
md5:4abf402b9d0e38783fbda3873290b139
|
19.3 MB | Download |
md5:aacb8bddc90f506c5db4863caf8ee0ba
|
97.6 kB | Download |
md5:037fa6d49e58bead5285a5add48cc42b
|
6.4 MB | Download |
md5:a63b5cf00c0551b901b17ae9c0e28874
|
20.1 kB | Download |
md5:7e253c32785efba3267a2cac3ccd179c
|
4.4 kB | Download |
md5:a79a90332e8c141307eee024c2502ce7
|
6.4 kB | Download |
md5:4e7e80feffc923be4b5b230a0dff149a
|
2.3 MB | Download |
md5:abf5262e26fa3e2593c604d59329bed7
|
26.6 kB | Download |
md5:e8e2a91ef7a0021864cc78d4f46ea0d8
|
27.4 MB | Download |
md5:862dd25275b90fa116eb7a15e1dd4487
|
45.4 kB | Download |
md5:ca53af6036ff1c38dae144c45e6f9c60
|
5.1 MB | Download |
md5:279111c22fbc622671f4330516aa4995
|
39.6 kB | Download |
md5:77427277e8a766540197234b165f6b06
|
66.6 MB | Preview Download |
md5:a1921dd91a96fdd5308ab0109bb1f28e
|
548.9 MB | Preview Download |
md5:4b5e202f18f63b9d2e07f4af97cd84f9
|
308 Bytes | Preview Download |
md5:81b3e0667a42f67cf266e332c37d87e3
|
13.5 kB | Preview Download |
md5:90a1b1164f09888fc14aad339d0ec461
|
16.1 MB | Preview Download |
md5:de9dd7b0f89fc25165bcb101dc1f8192
|
14.9 MB | Preview Download |
md5:5a17e9ee5cacbdb8401324ef30172ad7
|
19.8 MB | Preview Download |
md5:6ac40b16bd6a4e0446aa1392ad522eaa
|
15.3 MB | Preview Download |
md5:3443079a60a75ed9ad2ebc6a1879f197
|
3.0 MB | Preview Download |
md5:86de33aa04a86eaeb7d085044dda1c8d
|
24.7 MB | Preview Download |
md5:b08fd47a3f8ee7d100ce05aff5337c6f
|
1.2 MB | Preview Download |
md5:6af849fd192ccaa9b2672e07da89fbcf
|
165.0 kB | Preview Download |