Skip to main content

sars

Species-area relationship curve fitting in Python. A conceptual mirror of the R sars package (Matthews et al. 2019), native to the Python scientific stack.

PyPI Python CI Docs License: MIT DOI

Installation

pip install sars

sars needs Python 3.11 or later. from_geodataframe, which computes site areas from polygons, needs the geo extra (geopandas and shapely):

pip install "sars[geo]"

Features

  • 20 SAR models — power, logarithmic, asymptotic, sigmoid, and more
  • Log-log power model — the classic straight-line fit of log S on log A, with standard errors and p values
  • Multi-model inference — fit all models at once, ranked by AICc with Akaike weights
  • Parameter uncertainty — standard errors, t tests and confidence intervals for each fitted parameter
  • Model averaging — weighted-average predictions across candidate models
  • Prediction — a table of predicted richness at any areas, from any fit
  • Residual checks — normality, homoscedasticity and negative-prediction checks on each fit, optionally leaving out the models that fail before averaging
  • Bootstrap confidence intervals — percentile-based CIs for averaged predictions
  • Threshold models — piecewise regression for detecting breakpoints (small island effect), with confidence intervals for the breakpoints by bootstrap or by inverted F test
  • Random placement — Coleman's null model for richness from a species-by-site abundance table, with a calibrated simulation test
  • General dynamic model — richness as a function of island area and a hump in island age (Whittaker et al. 2008), with nested-model comparison
  • Bundled datasets — seven published island datasets: load_galap, load_gala, load_aegean, load_aegean2, load_niering, load_schrader, load_xu
  • R-validated — fits, AICc weights, model averaging, threshold models, random placement and the general dynamic model are checked against R sars reference output, with every known difference listed in tests/test_r_reference.py

Quick start

import sars

# Load the built-in Galapagos dataset (Preston 1962)
galap = sars.load_galap()

# Fit a single model
fit = sars.sar_power(galap)
print(fit)
# SARFit(model='power', c=33.1803  z=0.2832, R²=0.4912, AICc=189.03)

# Fit all 20 models and compare
multi = sars.sar_multi(galap)
print(multi.summary[["model", "AICc", "delta_AICc", "weight"]].head())

# Model-averaged predictions
avg = sars.sar_average(galap)
predictions = avg.predict([1.0, 10.0, 100.0])

# Bootstrap confidence intervals
ci = sars.bootstrap_ci(galap, n_boot=100)

For a complete analysis of these data, see the worked example in the documentation. A second example takes published amphibian counts from 26 southern Appalachian sites, read from a CSV, through the same steps, and compares the classical log-log power fit with the non-linear one. A third computes site areas from polygons with from_geodataframe.

Available models

Type Models
Linear linear
Non-asymptotic, convex power, powerR, loga, koba
Non-asymptotic, convex or sigmoid epm1, p1
Non-asymptotic, sigmoid epm2, p2
Asymptotic, convex monod, negexpo, ratio
Asymptotic, convex or sigmoid asymp, mmf, heleg
Asymptotic, sigmoid gompertz, weibull3, weibull4, chapman, betap

Each model has a dedicated function (e.g. sars.sar_power(), sars.sar_negexpo()) and returns a SARFit object with parameters, R², AIC, AICc, and BIC.

Support and contributing

Bug reports, questions, and feature requests go in the issue tracker. The project has a single maintainer; expect a reply within a week. See CONTRIBUTING.md for the development setup, how to add a model, and the release process, and CODE_OF_CONDUCT.md for community expectations.

Citation

If you use this software, please cite it:

McMeen, J. (2026). sars: Species-area relationship curve fitting in Python. DOI

References

This package is a Python implementation inspired by the R sars package. The 20 SAR models and multi-model inference framework draw on the following works:

R sars package

  • Matthews TJ, Triantis KA, Whittaker RJ, Guilhaumon F (2019). sars: an R package for fitting, evaluating and comparing species-area relationship models. Ecography, 42, 1446-1455.
  • Matthews TJ, Guilhaumon F, Triantis KA, Borregaard MK, Whittaker RJ (2016). On the form of species-area relationships in habitat islands and true islands. Global Ecology and Biogeography, 25, 847-858.

SAR model reviews and synthesis

  • Triantis KA, Guilhaumon F, Whittaker RJ (2012). The island species-area relationship: biology and statistics. Journal of Biogeography, 39, 215-231.
  • Guilhaumon F, Mouillot D, Gimenez O (2010). mmSAR: an R-package for multimodel species-area relationship inference. Ecography, 33, 420-424.
  • Tjorve E (2003). Shapes and functions of species-area curves: a review of possible models. Journal of Biogeography, 30, 827-835.
  • Tjorve E (2009). Shapes and functions of species-area curves (II): a review of new models and parameterizations. Journal of Biogeography, 36, 1435-1445.

Original model formulations

  • Arrhenius O (1921). Species and area. Journal of Ecology, 9, 95-99. (power)
  • Gleason HA (1922). On the relation between species and area. Ecology, 3, 158-162. (loga)
  • Gompertz B (1825). On the nature of the function expressive of the law of human mortality. Philosophical Transactions of the Royal Society of London, 115, 513-583. (gompertz)
  • Kobayashi S (1975). The species-area relation. I. A model for discrete sampling. Researches on Population Ecology, 17, 87-96. (koba)
  • Monod J (1950). La technique de culture continue: theorie et applications. Annales de l'Institut Pasteur, 79, 390-410. (monod)
  • Morgan PH, Mercer LP, Flodin NW (1975). General model for nutritional responses of higher organisms. Proceedings of the National Academy of Sciences, 72, 4327-4331. (mmf)
  • Ratkowsky DA (1990). Handbook of Nonlinear Regression Models. Marcel Dekker, New York. (asymp, ratio)
  • Richards FJ (1959). A flexible growth function for empirical use. Journal of Experimental Botany, 10, 290-301. (chapman)
  • Rosenzweig ML (1995). Species Diversity in Space and Time. Cambridge University Press. (powerR)
  • Ulrich W, Buszko J (2003). Self-similarity and the species-area relation of Polish butterflies. Basic and Applied Ecology, 4, 263-270. (p1, p2)
  • Weibull W (1951). A statistical distribution function of wide applicability. Journal of Applied Mechanics, 18, 293-297. (weibull3, weibull4)
  • Minami M, Lennert-Cody CE, Gao W, Roman-Verdesoto M (2007). Modeling shark bycatch: the zero-inflated negative binomial regression model with smoothing. Fisheries Research, 84, 210-221. (betap)

Data

  • Preston FW (1962). The canonical distribution of commonness and rarity. Ecology, 43, 185-215, 410-432. (the bundled Galápagos plant dataset, load_galap; areas in km²)
  • Johnson MP, Raven PH (1973). Species number and endemism: the Galápagos Archipelago revisited. Science, 179, 893-895. (plants and endemic plants on 30 Galápagos islands, load_gala; areas in km²)
  • Sfenthourakis S, Triantis KA (2009). Habitat diversity, ecological requirements of species and the Small Island Effect. Diversity and Distributions, 15, 131-140. (terrestrial isopods on 90 Aegean islands, load_aegean; areas in km²)
  • Matthews TJ, Rigal F, Kougioumoutzis K, Trigas P, Triantis KA (2020). Unravelling the small-island effect through phylogenetic community ecology. Journal of Biogeography, 47, 2341-2352. (plants on 173 Aegean islands, load_aegean2; areas in km²)
  • Niering WA (1963). Terrestrial ecology of Kapingamarangi Atoll, Caroline Islands. Ecological Monographs, 33, 131-160. (plants on 32 islands of Kapingamarangi Atoll, load_niering; areas in km²)
  • Schrader J, Moeljono S, Keppel G, Kreft H (2019). Plants on small islands revisited: the effects of spatial scale and habitat quality on the species-area relationship. Ecography, 42, 1405-1414. (plants on 60 small islands in Raja Ampat, load_schrader; areas in km²)
  • Xu A, Han X, Zhang X, Millien V, Wang Y (2017). Nestedness of butterfly assemblages in the Zhoushan Archipelago, China: area effects, life-history traits and conservation implications. Biodiversity and Conservation, 26, 1375-1392. (butterflies on 42 islands, load_xu; areas in km²)
  • Gooriah L, Blowes SA, Sagouis A, Schrader J, Karger DN, Kreft H, Chase JM (2021). Synthesis reveals that island species-area relationships emerge from processes beyond passive sampling. Global Ecology and Biogeography, 30, 2119-2131. (the CC0 compilation load_schrader and load_xu come from)

Threshold models

  • Lerman PM (1980). Fitting segmented regression models by grid search. Journal of the Royal Statistical Society C, 29, 77-84. (threshold_ci, method="F")
  • Matthews TJ, Rigal F (2021). Thresholds and the species-area relationship. Frontiers of Biogeography, 13, e49404.
  • Toms JD, Lesperance ML (2003). Piecewise regression: a tool for identifying ecological thresholds. Ecology, 84, 2034-2041. (threshold_ci)

Random placement

  • Coleman BD (1981). On random placement and species-area relations. Mathematical Biosciences, 54, 191-215. (coleman)
  • Coleman BD, Mares MA, Willig MR, Hsieh Y-H (1982). Randomness, area, and species richness. Ecology, 63, 1121-1133. (coleman)

General dynamic model

  • Whittaker RJ, Triantis KA, Ladle RJ (2008). A general dynamic theory of oceanic island biogeography. Journal of Biogeography, 35, 977-994. (sar_gdm)

Metadata

Release files for sars 0.11.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sars 0.11.2
File Size Uploaded Provenance Actions
sars-0.11.2.tar.gz 1.1 MB With provenance Details for sars-0.11.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sars 0.11.2
File Interpreter ABI Platform Actions
sars-0.11.2-py3-none-any.whl Python 3 none any Details for sars-0.11.2-py3-none-any.whl

Total release size: 1.2 MB

Release files / sars-0.11.2.tar.gz

Download URL sars-0.11.2.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9e62afa22f20176cd47458715f6272e8db7f0040374efc201b0836f518ca93c5
BLAKE2b-256 checksum
How to use checksums
a3053dc264c8e29acf0ada3d12e35717fac3362c29389b9e54ad13f63e67bec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / sars-0.11.2-py3-none-any.whl

Download URL sars-0.11.2-py3-none-any.whl
Size 97.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00556f2063e571f3691606cf637c4c1d46cea4757a12edb5054a733d51d89eb3
BLAKE2b-256 checksum
How to use checksums
4e1e71c7132dc0cc4312f6c4a182bcfcaef83023bf0287f904da1033429b658d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for sars 0.11.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sars-0.11.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page