sar_asymp: Fit the Asymptotic regression model

View source: R/sar_asymp.R

sar_asympR Documentation

Fit the Asymptotic regression model

Description

Fit the Asymptotic regression model to SAR data.

Usage

sar_asymp(data, start = NULL, grid_start = 'partial',
  grid_n = NULL, normaTest = 'none',
  homoTest = 'none', homoCor = 'spearman', verb = TRUE)

Arguments

data

A dataset in the form of a dataframe with two columns: the first with island/site areas, and the second with the species richness of each island/site.

start

NULL or custom parameter start values for the optimisation algorithm.

grid_start

Should a grid search procedure be implemented to test multiple starting parameter values. Can be one of 'none', 'partial' or 'exhaustive' The default is set to 'partial'.

grid_n

If grid_start = exhaustive, the number of points sampled in the starting parameter space.

normaTest

The test used to test the normality of the residuals of the model. Can be any of 'lillie' (Lilliefors test , 'shapiro' (Shapiro-Wilk test of normality), 'kolmo' (Kolmogorov-Smirnov test), or 'none' (no residuals normality test is undertaken; the default).

homoTest

The test used to check for homogeneity of the residuals of the model. Can be any of 'cor.fitted' (a correlation of the residuals with the model fitted values), 'cor.area' (a correlation of the residuals with the area values), or 'none' (no residuals homogeneity test is undertaken; the default).

homoCor

The correlation test to be used when homoTest !='none'. Can be any of 'spearman' (the default), 'pearson', or 'kendall'.

verb

Whether or not to print certain warnings (default = TRUE)

Details

The model is fitted using non-linear regression. The model parameters are estimated by minimizing the residual sum of squares with an unconstrained Nelder-Mead optimization algorithm and the optim function. To avoid numerical problems and speed up the convergence process, the starting values used to run the optimization algorithm are carefully chosen. However, if this does not work, custom values can be provided (using the start argument), or a more comprehensive search can be undertaken using the grid_start argument. See the vignette for more information. The fitting process also determines the observed shape of the model fit, and whether or not the observed fit is asymptotic (see Triantis et al. 2012 for further details). Model validation can be undertaken by assessing the normality (normaTest) and homogeneity (homoTest) of the residuals and a warning is provided in summary.sars if either test is chosen and fails. A selection of information criteria (e.g. AIC, BIC) are returned and can be used to compare models (see also sar_average).

As grid_start has a random component, when grid_start != 'none' in your model fitting, you can get slightly different results each time you fit a model

The parameter confidence intervals returned in sigConf are just simple confidence intervals, calculated as 2 * standard error.

Value

A list of class 'sars' with the following components:

  • par The model parameters

  • value Residual sum of squares

  • counts The number of iterations for the convergence of the fitting algorithm

  • convergence Numeric code returned from optim indicating model convergence (0 = converged)

  • message Any message from the model fit algorithm

  • hessian A symmetric matrix giving an estimate of the Hessian at the solution found

  • verge Logical code indicating that optim model convergence value is zero

  • startValues The start values for the model parameters used in the optimisation

  • data Observed data

  • model A list of model information (e.g. the model name and formula)

  • calculated The fitted values of the model

  • residuals The model residuals

  • AIC The AIC value of the model

  • AICc The AICc value of the model

  • BIC The BIC value of the model

  • R2 The R2 value of the model

  • R2a The adjusted R2 value of the model

  • sigConf The model coefficients table

  • normaTest The results of the residuals normality test

  • homoTest The results of the residuals homogeneity test

  • observed_shape The observed shape of the model fit

  • asymptote A logical value indicating whether the observed fit is asymptotic

  • neg_check A logical value indicating whether negative fitted values have been returned

The summary.sars function returns a more useful summary of the model fit results, and the plot.sars plots the model fit.

References

Triantis, K.A., Guilhaumon, F. & Whittaker, R.J. (2012) The island species-area relationship: biology and statistics. Journal of Biogeography, 39, 215-231.

Examples

data(galap)
fit <- sar_asymp(galap)
summary(fit)
plot(fit)

txm676/mmSAR2 documentation built on Nov. 21, 2024, 5:03 a.m.