<!-- Source: https://docs.biosimulant.com/examples/ecology-leibovich-multispecies -->

# Ecology: Multispecies Competition

A stochastic community model. **Several species compete for shared resources while immigration trickles in new individuals**, and the run shows how competition overlap and immigration rate together set richness, total abundance, and dominance.

## What it simulates

- Tau-leaping approximation of Gillespie dynamics.
- Per-species birth propensity from current abundance plus a flat immigration rate.
- Death propensity that grows with crowding, mixing intraspecific and interspecific terms via a single overlap parameter.
- Default run: six species, carrying capacity 100, modest competition overlap and immigration.

![Leibovich2022 species abundance trajectories and community metrics](/images/examples/ecology-leibovich-multispecies/leibovich2022-canvas-results.png)

## Run it on the Hub

1. Open the [Leibovich2022 Multispecies Competition Lab](https://hub.biosimulant.com/labs/1348127f-35df-4b01-9cdd-e75307c31063) on the public Hub.
2. Click **Run**. The default scenario runs for 500 time units.

## Inputs you can tune

| Input | Meaning |
|---|---|
| `carrying_capacity` | Habitat carrying capacity. |
| `birth_rate` | Per-capita birth rate. |
| `death_rate` | Per-capita baseline death rate. |
| `competition_overlap` | 0 = pure intraspecific competition; 1 = full interspecific competition. |
| `immigration_rate` | Constant per-species immigration rate. |
| `initial_abundance` | Starting abundance per species. |
| `rng_seed` | Random seed for reproducibility. |

## What results to expect

- **Per-species abundance**: stochastic fluctuations around a shared carrying capacity. Species can collapse to zero and re-enter through immigration.
- **Community metrics**: total abundance, species richness, and Shannon diversity over time.
- **Summary table**: final and extremal abundances, peak richness, and the dominant species at the end.

![Leibovich2022 community metrics and summary table](/images/examples/ecology-leibovich-multispecies/leibovich2022-community-summary.png)

## Reference

Faithful Python port of the upstream Julia/Python Gillespie code from Leibovich et al. (2022), [BioModels MODEL2212080001](https://www.ebi.ac.uk/biomodels/MODEL2212080001).

**Info:**

  Source on GitHub: [models-ecology — leibovich2022-multispecies-competition](https://github.com/Biosimulant/models-ecology/tree/main/labs/ecology-leibovich2022-multispecies-competition).
