- Notifications
You must be signed in to change notification settings - Fork4
txm676/sars
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
fit and compareSpecies-Area Relationship (SAR) models usingmulti-model inference
sars provides functionality to fit twenty SAR model using non-linearregression, and to calculate multi-model averaged curves using variousinformation criteria. The software also provides easy to usefunctionality to plot multi-model SAR curves and to generate confidenceintervals using bootstrapping. Additional SAR related functions includefitting the linear version of the power model and comparing parameterswith the non-linear version, fitting the general dynamic model of islandbiogeography, fitting the random placement model to a speciesabundance-site matrix, and extrapolating fitted SAR models to predictrichness on larger islands / sample areas. Version 1.3.0 has addedfunctions for fitting, evaluating and plotting a range of commonly usedpiecewise SAR models (see Matthews and Rigal (2021) for details on thesefunctions). Version 2.0.0 has added functions to fit a range of habitatand countryside SAR models (see Furness et al. (2023), Pereira and Daily(2006) and Proenca and Pereira (2013)), along with associated plot andprediction functions.
Please report any bugs or issues to us via GitHub.
The package has an associated vignette that provides examples of how touse the package, and three accompanying papers (Matthews et al. (2019),Matthews and Rigal (2021) and Matthews et al. (2025) In review).
Version 1.1.1 of the package has been archived on the Zenodo researchdata repository (DOI: 10.5281/zenodo.2573067).
You can install the released version of sars fromCRAN with:
install.packages("sars")And the development version fromGitHub with:
# install.packages("devtools")devtools::install_github("txm676/sars")
Basic usage ofsars will result in using two types of functions:
To fit the power sar model (Arrhenius 1921) to the ‘galapagos’ (Preston1962) data set:
fit_pow<- sar_power(data=galap)fit_pow#>#> Model:#> Power#>#> Call:#> S == c * A^z#>#> Coefficients:#> c z#> 33.1791553 0.2831868
Attempting to fit all 20 sar models to the ‘galapagos’ (Preston 1962)data set and get a multi-model SAR:
mm_galap<- sar_average(data=galap)#>#> Models to be fitted using a grid start approach:#>#> Now attempting to fit the 20 SAR models:#>#> ── multi_sars ────────────────────────────────────────────── multi-model SAR ──#> → power : ✔#> → powerR : ✔#> → epm1 : ✔#> → epm2 : ✔#> → p1 : ✔#> → p2 : ✔#> → loga : ✔#> → koba : ✔#> → monod : ✔#> → negexpo : ✔#> → chapman : ✔#> → weibull3 : ✔#> → asymp : ✔#> → ratio : ✔#> → gompertz : ✔#> → weibull4 : ✔#> → betap : ✔#> → logistic : ✔#> → heleg : ✔#> → linear : ✔#>#> No model validation checks selected#>#> 20 remaining models used to construct the multi SAR:#> Power, PowerR, Extended Power model 1, Extended Power model 2, Persistence function 1, Persistence function 2, Logarithmic, Kobayashi, Monod, Negative exponential, Chapman Richards, Cumulative Weibull 3 par., Asymptotic regression, Rational function, Gompertz, Cumulative Weibull 4 par., Beta-P cumulative, Logistic(Standard), Heleg(Logistic), Linear model#> ────────────────────────────────────────────────────────────────────────────────
Each of the ‘fitted’ objects have corresponding plot methods:
To fit the logarithmic SAR model (Gleason 1922) to the ‘galapagos’ dataset and plot it
fit_loga<- sar_loga(data=galap)plot(fit_loga)
To fit a multimodel SAR curve to the ‘galapagos’ data set and plot it(alongside the individual model fits)
mm_galap<- suppressMessages(sar_average(data=galap,verb=FALSE))#>#> Models to be fitted using a grid start approach:#>#> Now attempting to fit the 20 SAR models:#>#> ── multi_sars ────────────────────────────────────────────── multi-model SAR ──#> → power : ✔#> → powerR : ✔#> → epm1 : ✔#> → epm2 : ✔#> → p1 : ✔#> → p2 : ✔#> → loga : ✔#> → koba : ✔#> → monod : ✔#> → negexpo : ✔#> → chapman : ✔#> → weibull3 : ✔#> → asymp : ✔#> → ratio : ✔#> → gompertz : ✔#> → weibull4 : ✔#> → betap : ✔#> → logistic : ✔#> → heleg : ✔#> → linear : ✔#>#> No model validation checks selected#>#> 20 remaining models used to construct the multi SAR:#> Power, PowerR, Extended Power model 1, Extended Power model 2, Persistence function 1, Persistence function 2, Logarithmic, Kobayashi, Monod, Negative exponential, Chapman Richards, Cumulative Weibull 3 par., Asymptotic regression, Rational function, Gompertz, Cumulative Weibull 4 par., Beta-P cumulative, Logistic(Standard), Heleg(Logistic), Linear model#> ────────────────────────────────────────────────────────────────────────────────mm_galap#>#> This is a sar_average fit object:#>#> 20 models successfully fitted#>#> AICc used to rank modelsplot(mm_galap,pLeg=FALSE,mmSep=TRUE)
To fit the two-threshold continuous model to the ‘aegean2’ dataset
fit<- sar_threshold(data=aegean2,mod= c("ContTwo"),interval=0.1,non_th_models=FALSE,logAxes="area",con=1,logT=log10,nisl=NULL)plot(fit,cex=0.8,cex.main=1.1,cex.lab=1.1,pcol="grey")
To fit the countryside SAR model (power form) to the ‘countryside’dataset and generate one of a range of different plots of the model fitthat can be generated
s3<- sar_countryside(data=countryside,modType="power",gridStart="none",habNam= c("AG","SH","F"),spNam= c("AG_Sp","SH_Sp","F_Sp","UB_Sp"))par(mar=c(5.1,4.1,4.1,7.5),xpd=TRUE)plot(s3,type=2,totSp=TRUE,lcol= c("black","aquamarine4","#CC661AB3" ,"darkblue","darkgrey"),pLeg=TRUE,legPos="topright",legInset= c(-0.27,0.3),lwd=1.5,ModTitle= c("Agricultural land","Shrubland","Forest"),which=2)
Arrhenius, O. 1921. “Species and Area.”TheJournal of Ecology 9 (1): 95.https://doi.org/10.2307/2255763.
Furness, E. N., E. E. Saupe, R. J. Garwood, P. D Mannion, and M. DSutton. 2023. “The jigsaw model: a biogeographicmodel that partitions habitat heterogeneity from area.”Frontiers of Biogeography 15: e58477.https://doi.org/10.21425/F5FBG58477.
Gleason, H. A. 1922. “On the Relation BetweenSpecies and Area.”Ecology 3 (2): 158–62.https://doi.org/10.2307/1929150.
Matthews, T. J., and F. Rigal. 2021. “Thresholdsand the species–area relationship: a set of functions for fitting,evaluating and plotting a range of commonly used piecewise models inR.”Frontiers of Biogeography 13: e49404.
Matthews, T. J., K. A. Triantis, R. J. Whittaker, and F. Guilhaumon.2019. “sars: an R package for fitting, evaluatingand comparing species–area relationship models.”Ecography 42:1446–55.https://doi.org/10.1111/ecog.04271.
Pereira, H. M., and G. C. Daily. 2006. “Modellingbiodiversity dynamics in countryside landscapes.”Ecology 87:1877–85.https://doi.org/10.1890/0012-9658(2006)87[1877:MBDICL]2.0.CO;2.
Preston, F. W. 1962. “The Canonical Distribution ofCommonness and Rarity: Part I.”Ecology 43 (2): 185.https://doi.org/10.2307/1931976.
Proenca, V., and H. M. Pereira. 2013. “Species–areamodels to assess biodiversity change in multi-habitat landscapes: Theimportance of species habitat affinity.”Basic and AppliedEcology 14: 102–14.https://doi.org/10.1016/j.baae.2012.10.010.
About
The sars R package
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.




