residuals.ssMRCD | R Documentation |
Extracting Residuals from Local Fit
## S3 method for class 'ssMRCD'
residuals(object, ...)
object |
|
... |
see details |
Other input variables are:
remove_outliers | logical (default FALSE ). If TRUE, only residuals
from not outlying observations are calculated. If FALSE, trimmed residuals are used (see alpha ). |
X | matrix of new data, if data from the ssMRCD object is used. |
groups | vector of groups for new data, if NULL data from the ssMRCD object is used. |
mean | logical (default FALSE ), specifying if mean of trimmed
observations is returned or all residuals. |
If X
and groups
are provided, alpha
is set to one and all residuals are used.
If remove_outliers
is TRUE, alpha
is set to 1 automatically.
Returns either all residuals or the mean of the residual norms lower than the alpha
- Quantile.
# create data set
x1 = matrix(runif(200), ncol = 2)
x2 = matrix(rnorm(200), ncol = 2)
x = list(x1, x2)
# create weighting matrix
W = matrix(c(0, 1, 1, 0), ncol = 2)
# calculate ssMRCD
localCovs = ssMRCD(x, weights = W, lambda = 0.5)
# residuals of model
residuals(localCovs, remove_outliers = TRUE, mean = FALSE)
# residuals of new data
residuals(localCovs,
X = matrix(rnorm(20), ncol = 2, nrow = 10),
groups = rep(2, 10),
mean =TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.