landsim
: Efficient simulation of landscape-scale populations
This is an R package with tools to run efficient, forwards-time simulation of populations on habitats derived from GIS raster layers.
Install it by installing devtools
and running
devtools::install_github("petrelharp/landsim")
Here are some vignettes showing what it can do:
- Object structure : Describes the modeling strategy and how information is stored in population and demography objects.
- Density dependence : Demonstrates a few different ways of implementing density-dependent population size regulation.
- Types of selection : Demonstrates a few different ways of implementing genotype-dependent selection.
- Spatial sweeps : Simulates and analyzes an expanding wave of an advantageous allele.
- A selective sweep : Works through the modeling choices of a model of selection.
- Steps in a generation : Works through the guts of the steps in a simulation.
- Migration methods : Explains how to implement various types of migration: conservative or not, and different boundary types.
- Migration method run times : Examines the details of two methods of migration, using precomputed sparse Matrix objects, and using
raster
methods. - Sierpinski habitat : Creates a random (Sierpinski gasket) habitat.
A more generally useful function is discretize_kernel(), which allows you to translate from continuous migration kernels to discrete migration rates between grid cells in a natural way that is consistent across different grid resolutions.