fig.dim <- 3
knitr::opts_chunk$set(fig.width=3*fig.dim,fig.height=fig.dim,fig.align='center')
library(Matrix)
library(raster)
library(landsim)
set.seed(42)

Suppose, just for fun, that we have a population living on the Sierpinski gasket. There's a handy function to create this:

diam <- 1e4
habitat <- raster(xmn=-diam, xmx=diam, ymn=-diam, ymx=diam, 
      resolution=100,
      crs="+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
values(habitat) <- 1.0
sierp <- sierpinski_overlay(habitat,random=TRUE,n=3)
plot(sierp)

Demography

Here's the demographic set-up:

germination_fun <- function (N, carrying.capacity, ...) {
    out <- r0 / ( 1 + migrate(rowSums(N),competition)/carrying.capacity )
    return( cbind( aa=out, aA=s*out, AA=s^2*out ) )
}

this.demography <- demography(
        prob.seed = 0.2,
        fecundity = 100,
        prob.germination = vital( germination_fun, 
                r0 = 0.01,  # one in 100 seeds will germinate at low densities
                s = 1.5,    # multiplicative selective benefit of the A allele
                competition = migration(
                                     kern="gaussian",
                                     sigma=100,
                                     radius=300,
                                     normalize=1
                                 )
                ),
        prob.survival = 0.9,
        pollen.migration = migration(
                            kern = function (x) { exp(-sqrt(x)) },
                            sigma = 30,
                            radius = 500,
                            normalize = NULL
                     ),
        seed.migration = migration(
                            kern = "gaussian",
                            sigma = 50,
                            radius = 400,
                            normalize = 1
                     ),
        genotypes = c("aa","aA","AA"),
        mating = mating_tensor( c("aa","aA","AA") )
    )

Probability of establishment

The probability of establishment only depends on what happens relatively nearby. We'll select random neighborhoods, seed them with mutants, and see how many establish.

Wave speed



petrelharp/landsim documentation built on May 25, 2019, 2:53 a.m.