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
Prerequisites: Parametric and Non-Parametric Methods, Hypothesis Testing
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