Learn R Programming

paleoMAS (version 2.0-1)

bcrossv.l: LOESS regression parameters selection through bootstrap cross-validation for one taxon

Description

This function applies v-fold crossvalidation (CV) of LOESS regressions with varying $\alpha$ and degree for a single taxon.

Usage

bcrossv.l(x, y, interval = c(0.15, 1, 0.05), trials = c(10, 0.25), plot = TRUE)

Arguments

x
A vector containing the environmental gradient value for each sample or location.
y
A vector containing the observed taxa abundances along the environmental gradient.
interval
$\alpha$ values to be evaluated. Three numbers in the following order: lower and upper limits of the $\alpha$-values sequenceto be evaluated, and the increment of the sequence.
trials
Values for number of repetitions of the crossvalidation (100 by default), and proportion of observations to be left out each time the CV is repeated (0.25 by default). The observations left out each time are randomly selected with replacement.
plot
Logical indicating whether or not an observed vs. error is desired

Value

A matrix of 4 columns. All possible combinations of $\alpha$ values generated by the sequence interval and degree 1 and 2 are contained in the first and second columns. The third column contains the root of the predictive squared error (rse, (1/n*sum(est-obs)^2)^0.5). The fourth column contains the root mean squared error (rmse, 1/n*sum(abs(obs-est))). If plot=TRUE, a scatter plot of the rse and the rmse conditioned to the degree of the loess regression is produced.This function involves very intensive computations. Therefore, the user must find a balance between values of interval and trials, and the computational capabilities. Large number of trials may require long computation times.

Details

A sequence of $\alpha$ values is generated according to the range and increments declared in interval (from 0.15 to 1 in 0.05 increments). The sequence of $\alpha$ values is combined with degree 1 and 2, and the LOESS regression produced using each combination is cross-validated as explained in bcrossv.l1. See Cleveland and Devlin (1988) for details on loess regression.

References

Cleveland, W.S., and S.J. Devlin. 1988. Locally weighted regression: An approach to regression analysis by local fitting. Journal of the American Statistical Association 83: 596-610.

See Also

loess for details on loess regression. bcrossv.l1 for details on the bootstrap cross-validation.

Examples

Run this code
data(modernq)
# Calculate percentages
perq<-percenta(modernq,first=2,last=39)[,2:55]
# Cross-validation for Pinus
bcrossv.l(modernq[,1],perq[,3],trials=c(10,0.1))

Run the code above in your browser using DataLab