Fit the linear model to SAR data.
sar_linear(data, normaTest = 'lillie', homoTest = 'cor.fitted')
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.
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).
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).
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
The summary.sars
function returns a more useful summary of
the model fit results, and the plot.sars
plots the model fit.
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 fit_collection
and
sar_multi
).
# NOT RUN {
data(galap)
fit <- sar_linear(galap)
summary(fit)
plot(fit)
# }
Run the code above in your browser using DataLab