Learn R Programming

sars (version 1.0.0)

lin_pow: Fit the log-log version of the power model

Description

Fit the log-log version of the power model to SAR data and return parameter values, summary statistics and the fitted values.

Usage

lin_pow(data, con = 1, compare = FALSE, 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.

con

The constant to add to the species richness values in cases where one of the islands has zero species.

compare

Fit the standard (non-linear) power model and return the z-value for comparison (default: compare = FALSE).

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 up to six elements. The first element is an object of class 'summary.lm'. This is the summary of the linear model fit using the lm function and the user's data. The second element is a numeric vector of the model's fitted values, and the third contains the log-transformed observed data. The remaining elements depend on the function arguments selected and can include the results of the non-linear power model fit, and of the residuals normality and heterogeneity tests.

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

Details

A check is made for any islands with zero species. If any zero species islands are found, a constant (default: con = 1) is added to each species richness value to enable log transformation. Natural logarithms are used.

The compare argument can be used to compare the c and z values calculated using the log-log power model with that calculated using the non-linear power model. Note that the log-log function returns logc.

Examples

Run this code
# NOT RUN {
data(galap)
fit <- lin_pow(galap, con = 1)
summary(fit)
plot(fit)
# }

Run the code above in your browser using DataLab