sar_linear {sars}R Documentation

Fit the linear model

Description

Fit the linear model to SAR data.

Usage

sar_linear(data, 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.

normaTest

The test used to test the normality of the residuals of the model. Can be any of 'lillie' (Lilliefors Kolmogorov-Smirnov 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 linear regression and the lm function. 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).

Value

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

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

Examples

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

[Package sars version 1.3.6 Index]