View source: R/mod_linear_power.R
lin_pow | R Documentation |
Fit the log-log version of the power model to SAR data and return parameter values, summary statistics and the fitted values.
lin_pow(data, con = 1, logT = log, compare = FALSE, normaTest =
"none", homoTest = "none", homoCor = "spearman")
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. |
logT |
The log-transformation to apply to the area and richness values.
Can be any of |
compare |
Fit the standard (non-linear) power model and return the
z-value for comparison (default: |
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 |
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 as default, but log2 and log10 can be used instead
using the logT
argument.
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 log(c).
A list of class "sars" with up to seven 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, the log-transformation function used (i.e.
logT
) and the results of any 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.
data(galap)
fit <- lin_pow(galap, con = 1)
summary(fit)
plot(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.