Fit the linear model to SAR data.

sar_linear(data, normaTest =  'lillie', homoTest = 'cor.fitted')

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.

normaTest

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

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; the default), 'cor.area' (a correlation of the residuals with the area values), or 'none' (no residuals homogeneity test is undertaken).

Value

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

  • par The model parameters

  • value Residual sum of squares

  • verge Logical code indicating model convergence

  • 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

  • observed_shape The observed shape of the model fit

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

  • normaTest The results of the residuals normality test

  • homoTest The results of the residuals homogeneity test

  • 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.

Details

The model is fitted using linear regression and the lm function. Model validation is undertaken by assessing the normality (normaTest) and homogeneity (homoTest) of the residuals and a warning is provided in summary.sars if either test is failed.

A selection of information criteria (e.g. AIC, BIC) are returned and can be used to compare models (see also sar_average).

Examples

data(galap) fit <- sar_linear(galap) summary(fit)
#> #> Model: #> Linear model #> #> Call: #> S == c + m*A #> #> Did the model converge: TRUE #> #> Residuals: #> 0% 25% 50% 75% 100% #> -107.90 -52.10 -24.15 31.75 218.00 #> #> Parameters: #> Estimate Std. Error t value Pr(>|t|) 2.5 % 97.5 % #> c 70.314003 25.743130 2.731370 0.016228 15.100481 125.5275 #> m 0.185382 0.072884 2.543504 0.023410 0.029060 0.3417 #> #> R-squared: 0.32, Adjusted R-squared: 0.21 #> AIC: 146.36, AICc: 148.36, BIC: 148.68 #> Observed shape: linear, Asymptote: FALSE #> #> #> Warning: The normality test selected indicated the model residuals are not normally distributed (i.e. P < 0.05)
plot(fit)