Learn R Programming

ssMRCD (version 1.1.0)

select_smoothing: Optimal Smoothing Parameter for ssMRCD based on Residuals

Description

The optimal smoothing value for the ssMRCD estimator is based on the residuals and the trimmed mean of the norm.

Usage

select_smoothing(
  X,
  groups,
  weights,
  lambda = seq(0, 1, 0.1),
  TM = NULL,
  alpha = 0.75,
  seed = 123436,
  return_all = TRUE,
  cores = 1
)

Value

lambda_optoptimal lambda for smoothing.
COVSssMRCD object with optimal parameter setting.
plotplot for optimal parameter setting.
residualsmean of norm of residuals for varying lambda.

Arguments

X

data matrix containing observations.

groups

grouping vector corresponding to X.

weights

weight matrix for groups, see rescale_weights, and geo_weights.

lambda

vector of parameter values for smoothing, between 0 and 1.

TM

target matrix, if not given MCD (or MRCD if non regular) is used with default values and alpha.

alpha

percentage of outliers to be expected.

seed

seed for ssMRCD calculations.

return_all

logical, if FALSE the function returns only the optimal lambda.

cores

integer, number of cores used for parallel computing.

Examples

Run this code
# create data set
x1 = matrix(runif(200), ncol = 2)
x2 = matrix(rnorm(200), ncol = 2)

# create weighting matrix
W = matrix(c(0, 1, 1, 0), ncol = 2)

select_smoothing (X = rbind(x1, x2),
                 groups = rep(c(1,2), each = 100),
                 weights = W,
                 lambda = seq(0, 1, 0.1),
                 return_all = TRUE,
                 cores = 1)

Run the code above in your browser using DataLab