Builds matrix population models (Leslie/Lefkovitch) and runs stochastic PVA simulations to assess extinction risk and IUCN criteria. Use this skill when the user mentions PVA, population viability, lambda growth rate, Leslie or Lefkovitch matrices, quasi-extinction thresholds, elasticity or sensitivity analysis, stochastic population projections, minimum viable population (MVP), or IUCN Criterion E assessment.
Domain: PVA · Leslie matrix · Demographic stochasticity · Extinction risk · IUCN criteria
Guides the agent through population viability analysis using deterministic matrix models and stochastic simulations. Covers construction of Leslie or Lefkovitch stage-structured matrices, computation of population growth rate (λ), sensitivity and elasticity analysis, stochastic projection with demographic and environmental variance, and estimation of extinction probability and mean time to extinction (MTE) for IUCN Red List assessment.
Invoke this skill when:
trigger_keywords: PVA, population viability, , , , , , , , , , , , ,
extinction riskminimum viable populationLeslie matrixLefkovitch matrixpopulation projectionlambdademographic analysisIUCN criterionquasi-extinctionstochastic simulationvital ratessurvival ratefecundity| Input | Format | Required |
|---|---|---|
| Vital rates table (survival, growth, fecundity by stage/age) | CSV | Required |
| Number of projection years | Integer (default: 100) | Required |
| Number of stochastic simulations | Integer (default: 1000) | Recommended |
| Quasi-extinction threshold (Ne) | Integer (default: 50) | Recommended |
| Coefficient of variation for vital rates (stochastic variance) | CSV or floats | Recommended |
| Initial population size and stage distribution | CSV or vector | Optional |
| Output | Description |
|---|---|
lambda_estimates.csv | Dominant eigenvalue λ with bootstrap 95% CI |
sensitivity_matrix.csv | Partial derivatives ∂λ/∂a_ij for each matrix element |
elasticity_matrix.csv | Proportional sensitivity e_ij for each matrix element |
population_projection.png | Deterministic N(t) trajectory over projection years |
extinction_probability.csv | P(extinction) and P(quasi-extinction) by year |
mte_estimate.csv | Mean time to extinction with 95% CI |
stochastic_trajectories.png | Fan plot of 1000 stochastic population trajectories |
extinction_curve.png | Cumulative extinction probability over time |
Build the projection matrix
Read vital rates from CSV. Confirm all survival rates are in (0, 1] and fecundity ≥ 0.
Construct Leslie (age-structured) or Lefkovitch (stage-structured) matrix.
If stage boundaries are ambiguous, document choice in decision_log.md.
Compute λ and confidence interval (invoke matrix_pva.R)
Calculate dominant eigenvalue λ = Re(eigen(A)$values[1]).
Bootstrap vital rates (1000 resamples) to obtain 95% CI for λ.
If λ < 1.0: population declining. If λ < 0.95: high extinction risk.
Sensitivity and elasticity analysis Compute sensitivity matrix S and elasticity matrix E. Identify which vital rate (survival, growth, fecundity) most affects λ. High elasticity for adult survival → management interventions should target adults.
Deterministic projection
Project N(t) = A^t × N(0) over n_years.
If CV of vital rates > 0.30, note that deterministic projection underestimates variance.
Plot projection with initial population size.
Stochastic simulation (invoke stochastic_pva.R)
Draw vital rates from Beta (survival) and Poisson/Normal (fecundity) distributions
each time step using CV from input table.
Run n_simulations replicates. Track N(t) for each.
Calculate P(N(t) < Ne) for each year to produce extinction probability curve.
Compute MTE and IUCN assessment Mean time to extinction = mean year of first crossing Ne across simulations. Classify against IUCN criteria:
20% → Endangered; > 10% → Vulnerable.
Validate and document
Check λ from step 2 is consistent with stochastic simulation trend.
Record all vital rate sources, CV assumptions, and IUCN classification rationale
in decision_log.md.
| Condition | Diagnosis | Recommended Action |
|---|---|---|
| Vital rate data from < 3 years | High parametric uncertainty | Run sensitivity analysis across wide range; report P(extinction) as range, not point estimate |
| λ < 0.95 in deterministic model | Rapid deterministic decline | Calculate MTE even without stochasticity; management urgency is high |
| CV of vital rates > 0.30 | Environmental stochasticity dominates | Stochastic model is mandatory; deterministic λ is insufficient |
| N_initial < 50 | Below minimum viable population | Allee effects may apply; consider demographic stochasticity separately |
| Bootstrap CI for λ crosses 1.0 | λ not significantly different from 1 | Report both scenarios (λ > 1 and λ < 1); do not claim stability without longer monitoring |
Record the following in decision_log.md after running this skill:
R
suppressPackageStartupMessages(library(popbio)) # matrix PVA: lambda, sensitivity, elasticity
suppressPackageStartupMessages(library(dplyr)) # data manipulation
suppressPackageStartupMessages(library(tidyr)) # reshaping
suppressPackageStartupMessages(library(ggplot2)) # plotting trajectories and curves
suppressPackageStartupMessages(library(boot)) # bootstrapping vital rates
Python
import numpy as np # eigenvalue computation, matrix multiplication
import pandas as pd # vital rate tables
import matplotlib.pyplot as plt # trajectory plots
from pathlib import Path # file system
skills/population-viability-analysis/resources/matrix-model-guide.md — Leslie vs. Lefkovitch matrices, λ computation, sensitivity and elasticity reference tableskills/population-viability-analysis/resources/extinction-risk-thresholds.md — IUCN criteria A–E, quasi-extinction thresholds, MVP concept and literature valuesskills/population-viability-analysis/resources/sensitivity-elasticity-reference.md — Published elasticities by taxon group and management implications