An R package to predict changes in bird distributions and generate synthetic migration routes based on BirdFlow models.
Installation
Install just the package:
# install.packages("pak")
pak::pak("birdflow-science/BirdFlowR")Or install with example data and optional additional packages:
pak::pak("birdflow-science/BirdFlowR", dependencies = TRUE)See the Installation vignette for more information and help troubleshooting.
Usage
The two primary functions are route() to generate synthetic routes, and predict() to project distributions.
route()
route() generates synthetic migration routes from user specified starting locations. If unspecified, locations are sampled from the initial species distribution.
library(BirdFlowR)
library(BirdFlowExamples)
bf <- amewoo
species(bf)
#> [1] "American Woodcock"
# Generate and plot routes for the prebreeding migration
rts <- route(bf, n = 10, season = "prebreeding")
plot_routes(rts, bf)
predict()
predict() propagates an input distribution forward or backward in time. In this example we predict where birds from a randomly selected location in the winter will be in the summer.
set.seed(1)
initial_distribution <- get_distr(bf, 1)
location <- sample_distr(initial_distribution)
forecast <- predict(bf, distr = location, start = 1, end = 26, direction = "forward")
plot_distr(forecast[, c(1, 7, 14, 19)], bf, dynamic_scale = TRUE)
Learn more
-
vignette("BirdFlowR")has a longer introduction to the package, and how to usepredict()androute()to project bird distributions and movement. -
vignette("Installation")for detailed installation instructions. -
vignette("Preprocess")covers downloading and formatting data for model fitting withpreprocess_species(), importing fitted models withimport_birdflow(), and reducing model size withsparsify().
- Read the paper:
- BirdFlow: Learning Seasonal Bird Movements from Citizen Science Data Miguel Fuentes, Benjamin M. Van Doren, Daniel Fink, Daniel Sheldon bioRxiv 2022.04.12.488057; doi: https://doi.org/10.1101/2022.04.12.488057
