Maximum likelihood tools to fit and compare models of species abundance distributions and of species rank-abundance distributions.

**Paulo I. Prado, Murilo Miranda and Andre Chalom**

`install.packages('sads')library(sads)`

Or download binaries from CRAN.

**Developer version**

Master branch on GitHub has the release version, as available on CRAN.

If you want to install the developer version:

`library(devtools)install_github(repo = 'piLaboratory/sads', ref= 'dev', build_vignettes = TRUE)`

When running under Windows, you will need to install the Rtools package to build the vignettes locally.

An experimental branch implementing Lindsey's (1999) correction for the log-likelihood of continuous density distributions when used for discrete data can be installed by:

`library(devtools)install_github(repo = 'piLaboratory/sads', ref= 'trueLL', build_vignettes = TRUE)`

0.4.2 (2018-06-16)

- fixed bug that does not allow zero values in non-truncated poilog, geom, nbinom
- fix: diagnostic octav plot Plot #1 returned by plot methods for fitsad and fitrad methods had a truncated bar for the first octave.
- sads-package.Rd updated to be syncronized with package metadata
- rsads now allows a numeric vector in argument 'sads', to define an arbitrary community to be sampled

0.4.1 (2017-10-17)

- fixed fitpareto to have 2 degrees of freedom
- added Svolkov function
- removed deprecated "representation" from class definitions
- removed some checks for bugs in previous bbmle versions

0.4.0 (2017-06-11)

- added a "prop" argument for plotting relative rank abundances
- changed many details in plotting functions related to above change
- fixed registering external calls for R version 3.4
- fixed qbs not accepting non-integer N
- added continuous integration tests with TravisCI/AppVeyor
- added clarifications for building vignettes on README
- fixed a bug where plotprofmle would ignore input parameters
- tweaked fitgeom optimization a bit

0.3.1 (2016-05-12)

- Fixed a CRAN link on README

0.3.0 (2016-05-11)

- new functions for density, distribution, quantile and random generators function for the Pueyo's powerbend distribution
- several new functionalities for random sad generation (rsad)
- now providing random generator functions for all distributions in the package (such as rls, rmzsm, rzipf, etc)
- octav is now a S4 method, and octav plots have a new argument "mid=TRUE"
- new function and class for likelregions; also changed the spline method for plotting in plotprofmle
- better optimization and vectorization of several discrete quantile and distribution functions
- fixed the support of Zipf, Zipf-Mandelbrot and geometric series to not include zero abundances or zero-th rank
- added He & Tang's formula for initial parameter estimate of the geometric series
- more robust checking for invalid data in the fitting functions
- fixed bugs in octav, octavpred and dmzsm

0.2.4 (2015-11-02)

- octavpred now accepts a 'preston' argument (as does 'octav')
- fixes a bug in fitvolkov under Windows
- added a friendlier error message when the octavs provided in octavpred do not cover the data
- deprecated the slot "distr" on fitsad/fitrad objects. Now users should use the
`distr`

function (see ?distr) - fixed signature errors on several methods dealing with the
`trunc`

parameter - now providing the coefficients, fitted, fitted.values, residuals methods on fitsad/fitrad methods
- providing a summary method for fitsad/fitrad classes that allows for fixed parameters (such as produced by fitls, fitvolkov, etc)

0.2.3 (2015-09-24)

- fitgeom, fitpoilog and fitnbinom now can get argument trunc=NULL to avoid zero-truncation (the default)
- fitgeom uses default optimization method from mle2 instead of Brent's method, to avoid some overflow errors for large datasets (e.g. moths)
- dmzsm and dvolkov now returns zero for any abundance larger than the community size J. Accordingly, pzsm and pvolkov now return 1 for any q>J and lower.tail=TRUE and zero for lower.tail=FALSE.
- fixes important bugs in AICc

0.2.2 (2015-07-12)

- plotprofmle is now a S4 method with mle2 and profile.mle2 signatures
- Fixed the way \dots are handled by some of the fitting functions
- Better starting values for fitting Weibull distributions

0.2.1 (2015-06-14)

- Fixed some errors in the documentation

0.2.0 (2015-06-01)

- Reworked the Volkov distribution for performance.
- Reworked density, quantile and distribution functions for more consistent behaviour, error handling and large performance gains.
- Added some missing functions for mzsm, poig and poix families.
- New function
*updatesad*to update a fitsad with better fit from profile. *radpred*now uses exact solutions for extreme data points.- Reimplemented the
*AIC*and*AICc*functions for better integration with fitsad and fitrad classes. - Removed trueLL method to an experimental branch
- Improved grammar and clearer text in some manual pages and vignette.
- Improved starting values for several distributions.
- Replaced table(cut(x)) for hist for improved performance.
- octav and rad classes now have validation functions and are more consistent.
- More informative calls in
*show*and*summary*. - Reduced code redundancy and improved readability.
- Changed some "Depends" and "Imports" to make the package more light-weight, but still reliable
- Fixed the Broken-Stick family to behave like a Discrete distribution.
- Small but importante fixes in
*octavpred*. - Workarounds for bugs and issues of the bbmle package.

0.1.10 (2014-07-02)

- Initial release on CRAN.