fitted.mat {analogue} | R Documentation |
Extracts the fitted values for the training set of a MAT model using the, possibly weighted, mean of the environment for the k-closest analogues.
## S3 method for class 'mat': fitted(object, k, weighted = FALSE, ...)
object |
an object of class mat . |
k |
numeric; choose which of the k-closest analogue
models' fitted values is printed. Overides the default stored in
the object returned by fitted.mat . |
weighted |
logical; should weighted averages be used instead of simple averages? |
... |
arguments to be passed to other methods. |
The fitted values are for the training set and are taken as the, possibly weighted, mean of the environmental variable in question across the k-closest analogues. The fitted value for each sample does not include a contribution from itself — it is the closest analogue, having zero dissimilarity. This spurious distance is ignored and analogues are ordered in terms of the non-zero distances to other samples in the training set, with the k-closest contributing to the fitted value.
A list with the following components:
estimated |
numeric; a vector of fitted values. |
k |
numeric; this is the k-closest analogue model with lowest apparent RMSE. |
weighted |
logical; are the fitted values the weighted averages
of the environment for the k-closest analogues. If
FALSE , the fitted values are the average of the environment
for the k-closest analogues. |
Gavin L. Simpson
mat
for the model fitting function,
residuals.mat
for extraction of residuals. Related
functions are predict.mat
for predicting for unknown
samples and bootstrap
for bootstrap estimates for the
training set.
## continue the RLGH and SWAP example from ?join example(join) ## fit the MAT model using the squared chord distance measure swap.mat <- mat(swapdiat, swappH, method = "SQchord") swap.mat ## the fitted values: fitted(swap.mat) ## the fitted values for a MAT model ## with 10 analogues fitted(swap.mat, k = 10)