The Tietjen-Moore test algorithm is a generalization of the Grubbs' test algorithm, which is basically used for univariate datasets. The following algorithm depicts the detection of the multiple outliers in a univariate dataset by applying the Tietjen-Moore test algorithm. The following are the parameters used:
- Input parameter: Input data, including outliers
- Output parameters: Original data with outliers marked
The workflow is shown as follows:

The step-wise approach will help us to create the function in the desired way. We will carry out the following steps to implement the detection of outliers in R for the bank dataset:
- Create a function that assists in generating the outliers in R:
> TietjenMoore <- function(dataSeries,k)
+ {
+ n = length(dataSeries)
+ ## Compute the absolute residuals.
+ r = abs(dataSeries - mean(dataSeries))
+ ## Sort data...