residuals.mat {analogue} | R Documentation |
residuals
is a is a generic function which extracts
model residuals from objects returned by modeling
functions. residuals.mat
is a residuals
method
for mat
models.
The abbreviated form of this function is resid
.
## S3 method for class 'mat': residuals(object, k, weighted = FALSE, ...)
object |
an object of class mat . |
k |
number of analogues to use. If missing, k is chosen
automatically as the k that achieves lowest RMSE. |
weighted |
logical; should the weighted mean of the environment
for the "k" modern analogues be used instead of the mean? |
... |
arguments pass to or from other methods. |
A list with the following components:
residuals |
numeric; a vector of model residuals. |
k |
numeric; either the user supplied number of analogues used, or the k-closest analogue model with lowest apparent RMSE. |
weighted |
logical; are the residuals from a model where fitted
values are the weighted averages of the environment for the
k-closest analogues. If FALSE , the residuals are from
a model using the average of the environment for the
k-closest analogues. |
Gavin L. Simpson
## continue the RLGH example from ?join example(join) ## fit the MAT model using the squared chord distance measure swap.mat <- mat(swapdiat, swappH, method = "SQchord") ## model residuals resid(swap.mat) # uses abbreviated form ## model residuals using 10 analogues and ## weighted averages resid(swap.mat, k = 10, weighted = TRUE)