Learn R Programming

paleoMAS (version 2.0-1)

bcrossv.all: LOESS regression parameters selection through bootstrap cross-validation for multiple taxa

Description

This function applies v-fold crossvalidation (CV) of loess regressions with varying $\alpha$ and degree for multiple taxa. The final result contains $\alpha$ and degree values that minimize the error of the loess regression for each taxon.

Usage

bcrossv.all(x, y, interval = c(0.15, 1, 0.05), trials = c(10, 0.25), target = c("rse","rmse"))

Arguments

x
A vector containing the environmental gradient value for each sample or location.
y
A matrix containing the observed taxa abundances along the environmental gradient. Taxa are in columns and samples in rows.
interval
$\alpha$ values to be evaluated. Three numbers in the following order: lower and upper limits of the sequence of $\alpha$ values to be evaluated, and 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 (25 percent of observations by default). The observations left out each time are randomly selected with replacement.
target
If target="rse" the values of alpha and degree that minimize the LOESS regression root of the predictive squared error are selected. If target="rmse" the values of $\alpha$ and degree that minimize the LOESS regression root mean squared error are selected.

Value

A matrix containing $\alpha$ and degree values that minimize the LOESS regression rse or rmse (depending on the choice in target.)

References

Correa-Metrio, A., M.B. Bush, L.Perez, A. Schwalb, and K. Cabrera. Accepted. Pollen distribution along climatic and biogeographic gradients in northern Central America. The Holocene

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 and bcrossv.l for details on the bootstrap cross-validation.

Examples

Run this code
data(modernq)
# Calculate percentages
perq<-percenta(modernq,first=2,last=39)[,2:55]
bcrossv.all(modernq[,1],perq[,1:5],trials=c(10,0.1),target="rse")
bcrossv.all(modernq[,1],perq[,1:5],trials=c(10,0.1),target="rmse")

Run the code above in your browser using DataLab