WAPLS(y, x, npls=5, iswapls=TRUE, standx=FALSE, lean=FALSE,
check.data=TRUE, ...)
WAPLS.fit(y, x, npls=5, iswapls=TRUE, standx=FALSE, lean=FALSE)
## S3 method for class 'WAPLS':
predict(object, newdata=NULL, sse=FALSE, nboot=100,
match.data=TRUE, verbose=TRUE, \dots)
## S3 method for class 'WAPLS':
crossval(object, cv.method="loo", verbose=TRUE, ngroups=10,
nboot=100, h.cutoff=0, h.dist=NULL, \dots)
## S3 method for class 'WAPLS':
performance(object, \dots)
## S3 method for class 'WAPLS':
rand.t.test(object, n.perm=999, \dots)
## S3 method for class 'WAPLS':
screeplot(x, rand.test=TRUE, \dots)
## S3 method for class 'WAPLS':
print(x, \dots)
## S3 method for class 'WAPLS':
summary(object, full=FALSE, \dots)
## S3 method for class 'WAPLS':
plot(x, resid=FALSE, xval=FALSE, npls=1,
xlab="", ylab="", ylim=NULL, xlim=NULL, add.ref=TRUE,
add.smooth=FALSE, \dots)
## S3 method for class 'WAPLS':
residuals(object, cv=FALSE, \dots)
## S3 method for class 'WAPLS':
coef(object, \dots)
## S3 method for class 'WAPLS':
fitted(object, \dots)wa.FALSE if you are sure the column names match exactly.plot.wa.h.cutoff from each test sample will be used.WAPLS returns an object of class WAPLS with the following named elements:crossval also returns an object of class WAPLS and adds the following named elements:predict is called with newdata=NULL it returns the fitted values of the original model, otherwise it returns a list with the following named elements:newdata.performance returns a matrix of performance statistics for the WAPLS model. See performance, for a description of the summary.
Function rand.t.test returns a matrix of performance statistics together with columns indicating the p-value and percentage change in RMSE with each higher component (see van der Veot (1994) for details).WAPLS performs partial least squares (PLS) or weighted averaging partial least squares (WAPLS) regression. WAPLS was first described in ter Braak and Juggins (1993) and ter Braak et al. (1993) and has since become popular in palaeolimnology for reconstructing (predicting) environmental values from sub-fossil biological assemblages, given a training dataset of modern species and envionmental data. Prediction errors and model complexity (number of components) can be estimated by cross-validation using crossval which implements leave-one out, leave-group-out, or bootstrapping. With leave-group out one may also supply a vector of group memberships for more carefully designed cross-validation experiments.
Function predict predicts values of the environemntal variable for newdata or returns the fitted (predicted) values from the original modern dataset if newdata is NULL. Variables are matched between training and newdata by column name (if match.data is TRUE). Use compare.datasets to assess conformity of two species datasets and identify possible no-analogue samples.
WAPLS has methods fitted and rediduals that return the fitted values (estimates) and residuals for the training set, performance, which returns summary performance statistics (see below), coef which returns the species coefficients, and print and summary to summarise the output. WAPLS also has a plot method that produces scatter plots of predicted vs observed measurements for the training set.
Function rand.t.test performs a randomisation t-test to test the significance of the cross-validated components after van der Voet (1994).
Function screeplot displays the RMSE of prediction for the training set as a function of the number of components and is useful for estimating the optimal number for use in prediction. By default screeplot will also carry out a randomisation t-test and add a line to scree plot indicating percentage change in RMSE with each component annotate with the p-value from the randomisation test.WA, MAT, performance, and compare.datasets for diagnostics.data(IK)
spec <- IK$spec
SumSST <- IK$env$SumSST
core <- IK$core
fit <- WAPLS(spec, SumSST)
fit
# cross-validate model
fit.cv <- crossval(fit, cv.method="loo")
# How many components to use?
rand.t.test(fit.cv)
screeplot(fit.cv)
#predict the core
pred <- predict(fit, core, npls=2)
#plot predictions - depths are in rownames
depth <- as.numeric(rownames(core))
plot(depth, pred$fit[, 2], type="b", ylab="Predicted SumSST", las=1)
# predictions with sample specific errors
pred <- predict(fit, core, npls=2, sse=TRUE, nboot=1000)
predRun the code above in your browser using DataLab