select_smoothing: Optimal Smoothing Parameter for ssMRCD based on Residuals

View source: R/select_parameters.R

select_smoothingR Documentation

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
)

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.

Value

lambda_opt optimal lambda for smoothing.
COVS ssMRCD object with optimal parameter setting.
plot plot for optimal parameter setting.
residuals mean of norm of residuals for varying lambda.

Examples

# 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)

ssMRCD documentation built on Sept. 11, 2024, 5:14 p.m.