Learn R Programming

ssMRCD (version 1.1.0)

ssMRCD: Spatially Smoothed MRCD Estimator

Description

The ssMRCD function calculates the spatially smoothed MRCD estimator from Puchhammer and Filzmoser (2023).

Usage

ssMRCD(
  x,
  groups = NULL,
  weights,
  lambda,
  TM = NULL,
  alpha = 0.75,
  maxcond = 50,
  maxcsteps = 200,
  n_initialhsets = NULL
)

Value

An object of class "ssMRCD" containing the following elements:

MRCDcovList of ssMRCD-covariance matrices sorted by neighborhood.
MRCDicovList of inverse ssMRCD-covariance matrices sorted by neighborhood.
MRCDmuList of ssMRCD-mean vectors sorted by neighborhood.
mXList of data matrices sorted by neighborhood.
NNumber of neighborhoods.
mTTarget matrix.
rhoVector of regularization values sorted by neighborhood.
alphaScalar what percentage of observations should be used.
hVector of how many observations are used per neighborhood, sorted.
numiterThe number of iterations for the best initial h-set combination.
c_alphaConsistency factor for normality.
weightsThe weighting matrix.
lambdaSmoothing factor.
obj_fun_valuesA matrix with objective function values for all initial h-set combinations (rows) and iterations (columns).
best6packinitial h-set combinations with best objective function value after c-step iterations.
Kcovreturns MRCD-estimates without smoothing.

Arguments

x

a list of matrices containing the observations per neighborhood sorted which can be obtained by the function restructure_as_list, or matrix or data frame containing data. If matrix or data.frame, group vector has to be given.

groups

vector of neighborhood assignments

weights

weighting matrix, symmetrical, rows sum up to one and diagonals need to be zero (see also geo_weights or rescale_weights .

lambda

numeric between 0 and 1.

TM

target matrix (optional), default value is the covMcd from robustbase.

alpha

numeric, proportion of values included, between 0.5 and 1.

maxcond

optional, maximal condition number used for rho-estimation.

maxcsteps

maximal number of c-steps before algorithm stops.

n_initialhsets

number of initial h-sets, default is 6 times number of neighborhoods.

References

Puchhammer P. and Filzmoser P. (2023): Spatially smoothed robust covariance estimation for local outlier detection. tools:::Rd_expr_doi("10.48550/arXiv.2305.05371")

See Also

plot.ssMRCD, summary.ssMRCD, restructure_as_list

Examples

Run this code
# 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
ssMRCD(x, weights = W, lambda = 0.5)

Run the code above in your browser using DataLab