MAT(y, x, dist.method="sq.chord", k=5, lean=TRUE)
## S3 method for class 'MAT':
predict(object, newdata=NULL, k=object$k, sse=FALSE,
nboot=100, match.data=TRUE, verbose=TRUE, lean=TRUE,
\dots)
## S3 method for class 'MAT':
performance(object, \dots)
## S3 method for class 'MAT':
crossval(object, k=object$k, cv.method="lgo",
verbose=TRUE, ngroups=10, nboot=100, h.cutoff=0, h.dist=NULL, \dots)
## S3 method for class 'MAT':
print(x, \dots)
## S3 method for class 'MAT':
summary(object, full=FALSE, \dots)
## S3 method for class 'MAT':
plot(x, resid=FALSE, xval=FALSE, k=5, wMean=FALSE, xlab="",
ylab="", ylim=NULL, xlim=NULL, add.ref=TRUE,
add.smooth=FALSE, \dots)
## S3 method for class 'MAT':
residuals(object, cv=FALSE, \dots)
## S3 method for class 'MAT':
fitted(object, \dots)
## S3 method for class 'MAT':
screeplot(x, \dots)
paldist(y, dist.method="sq.chord")
paldist2(y1, y2, dist.method="sq.chord")FALSE if you are sure the column names match exactly.MAT.plot.wa.h.cutoff from each test sample will be used.MAT returns an object of class MAT which contains the following items:MAT.lean=FALSE).predict is called with newdata=NULL it returns a matrix of fitted values from the original training set analysis. If newdata is not NULL it returns list with the following named elements:newdata.lean=FALSE).paldist and paldist2 return dissimilarity matrices. performance returns a matrix of performance statistics for the MAT model, with columns for RMSE, R2, mean and max bias for each number of analogues up to k. See performance for a description of the output.MAT performs an environmental reconstruction using the modern analogue technique. Function MAT takes a training dataset of biological data (species abundances) y and a single associated environmental variable x, and generates a model of closest analogues, or matches, for the modern data data using one of a number of dissimilarity coefficients. Options for the latter are: "euclidean", "sq.euclidean", "chord", "sq.chord", "chord.t", "sq.chord.t", "chi.squared", "sq.chi.squared", "bray". "chord.t" are true chord distances, "chord" refers to the the variant of chord distance using in palaeoecology (e.g. Overpeck et al. 1985), which is actually Hellinger's distance (Legendre & Gallagher 2001). There are various help functions to plot and extract information from the results of a MAT transfer function. The function predict takes MAT object and uses it to predict environmental values for a new set of species data, 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.
MAT 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), and print and summary to summarise the output. MAT also has a plot method that produces scatter plots of predicted vs observed measurements for the training set.
Function screeplot displays the RMSE of prediction for the training set as a function of the number of analogues (k) and is useful for estimating the optimal value of k for use in prediction.
paldist and paldist1 are helper functions though they may be called directly. paldist takes a single data frame or matrix returns a distance matrix of the row-wise dissimilarities. paldist2 takes two data frames of matrices and returns a matrix of all row-wise dissimilarities between the two datasets.WAPLS, WA, performance, and compare.datasets for diagnostics.# pH reconstruction of the RLGH, Scotland, using SWAP training set
# shows recent acidification history
data(SWAP)
data(RLGH)
fit <- MAT(SWAP$spec, SWAP$pH, k=20) # generate results for k 1-20
#examine performance
performance(fit)
print(fit)
# How many analogues?
screeplot(fit)
# do the reconstruction
pred.mat <- predict(fit, RLGH$spec, k=10)
# plot the reconstruction
plot(RLGH$depths$Age, pred.mat$fit[, 1], type="b", ylab="pH", xlab="Age")
#compare to a weighted average model
fit <- WA(SWAP$spec, SWAP$pH)
pred.wa <- predict(fit, RLGH$spec)
points(RLGH$depths$Age, pred.wa$fit[, 1], col="red", type="b")
legend("topleft", c("MAT", "WA"), lty=1, col=c("black", "red"))Run the code above in your browser using DataLab