🌡️ Practical Environmental-Mismatch Extinction

Turn a hard niche boundary into a probability

Exercise

Create a gen3sis config in which a local population’s probability of extinction increases linearly with its environmental mismatch.

Here, environmental mismatch means the absolute distance along the temperature gradient between:

  • the temperature in the current site, and
  • the species’ optimal temperature.

It does not mean geographic distance between cells.

Your task

  1. Make a copy of data/config/config_simple.R and give it a new name.
  2. Find apply_ecology() in your copied config.
  3. Replace its deterministic thermal-niche rule with a stochastic extinction rule.
  4. Draw one extinction event for every species occurring in the site.
  5. Set the abundance of extinct local populations to 0, leave survivors unchanged, and return the abundance vector.

Your rule should behave like this:

Environmental mismatch Extinction probability
At the species’ optimum 0
Half of its niche width 0.5
At its niche width 1
Beyond its niche width 1
TipSmall hint

You will need abs() to calculate environmental mismatch, a way to cap probabilities at 1, and rbinom() for one Bernoulli extinction draw per local population.

Show the mathematical hint

\[ p_{\mathrm{ext}} = \min\left(1,\frac{|T_{\mathrm{site}}-T_{\mathrm{optimum}}|}{\mathrm{niche\ width}}\right) \]

Run the new config and compare its richness through time or final richness map with the original deterministic config. Because this is a probability per time step, remember that changing temporal resolution also changes the accumulated extinction risk.

Password-protected solution

Remember that the rule is local and stochastic: extreme abiotic stress yields population zeros, while well-matched populations may persist. The niche does not slam the door; it quietly adjusts the odds.