powered by
AddOutlier returns a matrix with outliers randomly added to a matrix given certain proportion of contamination
AddOutlier
AddOutlier(X, proportion, value, seed = NULL, method = "element")
A matrix with elements / rows / columns contaminated.
matrix
matrix, to which outliers are added
numeric, proportion of elements, rows or columns to be contaminated. Must be between 0 and 1.
numeric
numeric, the outlying value to be used for contamination
numeric, a seed to reproduce the randomization behaviour
character, must be one of the following:
character
"element" - For contaminating at random positions of the matrix
"element"
"row" - For contaminating an entire row of the matrix
"row"
"col" - For contaminating an entire column of the matrix
"col"
X = matrix(1:20, nrow = 4, ncol = 5) AddOutlier(X, 0.5, 10, seed = 1234)
Run the code above in your browser using DataLab