ssMRCD | R Documentation |

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

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

`x` |
a list of matrices containing the observations per neighborhood sorted which can be obtained by the function |

`weights` |
weighting matrix, symmetrical, rows sum up to one and diagonals need to be zero (see also |

`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. |

An object of class `"ssMRCD"`

containing the following elements:

`MRCDcov` | List of ssMRCD-covariance matrices sorted by neighborhood. |

`MRCDicov` | List of inverse ssMRCD-covariance matrices sorted by neighborhood. |

`MRCDmu` | List of ssMRCD-mean vectors sorted by neighborhood. |

`mX` | List of data matrices sorted by neighborhood. |

`N` | Number of neighborhoods. |

`mT` | Target matrix. |

`rho` | Vector of regularization values sorted by neighborhood. |

`alpha` | Scalar what percentage of observations should be used. |

`h` | Vector of how many observations are used per neighborhood, sorted. |

`numiter` | The number of iterations for the best initial h-set combination. |

`c_alpha` | Consistency factor for normality. |

`weights` | The weighting matrix. |

`lambda` | Smoothing factor. |

`obj_fun_values` | A matrix with objective function values for all initial h-set combinations (rows) and iterations (columns). |

`best6pack` | initial h-set combinations with best objective function value after c-step iterations. |

`Kcov` | returns MRCD-estimates without smoothing. |

Puchhammer P. and Filzmoser P. (2023): Spatially smoothed robust covariance estimation for local outlier detection. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2305.05371")}

`plot.ssMRCD, summary.ssMRCD, restructure_as_list`

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.