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.
Syntax: smirnov_grubbs.test(data, alpha)
Parameters:
- data: A numeric vector of data values
- alpha: The significance level to use for the test.
Example:
In this example, we are performing the two-sided Grubbs test, which will detect outliers on both ends of the dataset using the smirnov_grubbs.test() function in the python programming language.
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 ]) # perform Grubbs' test grubbs.test(data, alpha = . 05 ) |
Output:
array([20, 21, 26, 24, 29, 22, 21, 28, 27])
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
Contact Us