stdError {analogue}R Documentation

Standard error of MAT fitted and predicted values


Computes the (weighted) standard deviation of the environment for the k-closest analogues for each sample. This was proposed as one measure of reconstruction uncertainty for MAT models (ter Braak, 1995).


stdError(object, ...)

## S3 method for class 'mat'
stdError(object, k, weighted = FALSE, ...)

## S3 method for class 'predict.mat'
stdError(object, k, weighted = FALSE, ...)



Object for which the uncertainty measure is to be computed. Currently methods for mat and predict.mat.


numeric; how many analogues to take? If missing, the default, k is chosen using getK.


logical; use a weighted computation?


Additional arguments passed to other methods. Currently not used.


Two types of standard error can be produced depending upon whether the mean or weighted mean of y for the k closest analogues is used for the MAT predictions. If weighted = FALSE then the usual standard deviation of the response for the k closest analogues is returned, whereas for weighted = TRUE a weighted standard deviation is used. The weights are the inverse of the dissimilarity between the target observation and each of the k closest analogues.


A named numeric vector of weighted standard deviations of the environment for the k closest analogues used to compute the MAT predicted values.

The returned vector has attributes "k" and "auto", indicating the number of analogues used and whether this was determined from object or supplied by the user.


Gavin L. Simpson


Simpson, G.L. (2012) Analogue methods in palaeolimnology. In Birks, H.J.B, Lotter, A.F. Juggins S., and Smol, J.P. (Eds) Tracking Environmental Change Using Lake Sediments, Volume 5: Data Handling and Numerical Techniques. Springer, Dordrecht.

ter Braak, C.J.F. (1995) Non-linear methods for multivariate statistical calibration and their use in palaeoecology: a comparison of inverse (k-nearest neighbours, partial least squares, and weighted averaging partial least squares) and classical approaches. Chemometrics and Intelligent Laboratory Systems 28:165–180.

See Also

minDC, mat, predict.mat.


## Imbrie and Kipp Sea Surface Temperature

## merge training set and core samples
dat <- join(ImbrieKipp, V12.122, verbose = TRUE)

## extract the merged data sets and convert to proportions
ImbrieKipp <- dat[[1]] / 100
ImbrieKippCore <- dat[[2]] / 100

## fit the MAT model using the squared chord distance measure
ik.mat <- mat(ImbrieKipp, SumSST, method = "SQchord")

## standard errors - unweighted
## standard errors - weighted version for above
stdError(ik.mat, k = getK(ik.mat), weighted = TRUE)

## standard errors - weighted; note this uses more (7) analogues
## than the above as this model had lowest LOO error
stdError(ik.mat, weighted = TRUE)

## reconstruct for the V12-122 core data
coreV12.mat <- predict(ik.mat, V12.122, k = 3)
## standard errors

[Package analogue version 0.17-6 Index]