Extract the Index of the Outlier using the gribb’s test

In this approach, the user needs to follow the below syntax to get the index at which the outlier is present of the given data. 

grubbs.max_test_indices() function: This function returns the index of the outlier present in the array.

Syntax: grubbs.max_test_indices(data,alpha)

Python




import numpy as np
from outliers import smirnov_grubbs as grubbs
 
# define data
data = np.array([20, 21, 26, 24, 29, 22,
                 21, 50, 28, 27, 5])
 
grubbs.max_test_indices(data, alpha=.05)


Output:

[7]

How to Perform Grubbs’ Test in Python

In this article, we will be discussing the different approaches to perform Grubbs’ Test in Python programming language. 

Grubbs’ Test is also known as the maximum normalized residual test or extreme studentized deviate test is a test used to detect outliers in a univariate data set assumed to come from a normally distributed population. This test is defined for the hypothesis:

  • Ho: There are no outliers in the data set
  • Ha: There is exactly one oiler in the database

Similar Reads

Method 1: Performing two-side Grubbs’ Test

In this method to perform the grubb’s test, the user needs to call the smirnov_grubbs.test() function from the outlier_utils package passed with the required data passed as the parameters....

Method 2: Performing one-side Grubbs’ Test

...

Method 3: Extract the Index of the Outlier using the gribb’s test

In this approach to get the one-side grubb’s test, the user needs to call either grubbs.min_test() function to get the min. the outlier of the given data set or the grubbs.max_test() to get the max. outlier out from the given data set....

Method 4: Extract the value of the Outlier using the grubb’s test

...

Contact Us