# rssoptim: The Residual Sum of Squares optimisation function In mmSAR: mmSAR is an R package for the modelling of the Species-Area Relationship (SAR).

## Description

The rssoptim function is used to fit SAR models (as mmSAR model objects) to dataset (as mmSAR data objects). This function allow the optimisation of the model parameters, fitted values calculation, information criteria (AIC, AICc, BIC) and R<c2><b2> calculations and fit evaluation with residuals normality and homoscedasticity tests.

## Usage

 `1` ```rssoptim(model, data, norTest = "lillie", verb = TRUE) ```

## Arguments

 `model` A mmSAR model object representing the model to fit. `data` A mmSAR data object representing the data to fit the model on. `norTest` A character string from "lillie" or "shapiro" for respectively test for the normality of the residuals with a Lilliefors or Shapiro test. `verb` Bolean : should the function reports informations while running ?

## Details

The rssoptim function is basically a wrapper for the optim R built-in function. rssoptim obtains model parameters estimates by minimizing the residual sum of squares using the unconstrained Nelder<e2><80><93>Mead optimization algorithm. Assuming normality of the observations, this approach produces optimal maximum likelihood estimates of model parameters. rssoptim provides two tests for the normality of the residuals : the Lilliefors extension of the Kolmogorov normality test, which is advocated when sample size is large or when the data show a substantial variability (e.g. continental scale studies) and the Shapiro-Wilk test for normality, which focuses on skewness and kurtosis of the empirical distribution of the residuals and is useful for small sample size or when data results from small scale sampling. mmSAR tests for homoscedasticity by evaluating the correlation between residuals magnitude and areas (Pearson<e2><80><99>s product moment correlation coefficient).

## Value

A list :

1. \$par : the parameters estimates.

2. \$value : the value of the Residual Sum of Squares (RSS).

3. \$counts : number of iterations for the convergence of the fitting algorithm

4. \$convergence : optim convergence code (only 0 is OK).

5. \$message : optim convergence message (only NULL is OK).

6. \$sigConf : a p x 6 matrix with columns for the estimated coefficient, its standard error, t-statistic, corresponding (two-sided) p-value and lower & upper bounds of the 95

7. \$pearson : Pearson<e2><80><99>s product moment correlation coefficient value.

8. \$pearpval : Pearson<e2><80><99>s product moment correlation coefficient p.value.

9. \$normaTest : residuals normality test used.

10. \$normaStat : residuals normality test statistic value.

11. \$normaPval : residuals normality test statistic p.value.

12. \$startvalues : starting values for the fitting algorithm.

13. \$data : the data.

14. \$model : the mmSAR model object.

15. \$calculated : vector of fitted values.

16. \$residuals : vector of residuals.

17. \$AIC : AIC value.

18. \$AICc : AICc value.

19. \$BIC : BIC value.

20. \$R2a : R<c2><b2> value.

21. \$data.name : the name of the dataset (from the mmSAR data object).

## Author(s)

Francois Guilhaumon

`multiSAR`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```## Not run: #FITTING THE POWER MODEL TO THE GALAPAGOS DATASET #loading the data data(data.galap) #loading the model data(power) #fitting the model with verbosity rssoptim(power,data.galap,verb=TRUE) ## End(Not run) ```