Created
March 31, 2019 08:40
-
-
Save lmassaron/5e5ae72fed02d7b50a98007c03f6b936 to your computer and use it in GitHub Desktop.
Chauvenet's criterion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # In statistical theory, Chauvenet's criterion (named for William Chauvenet[1]) is a means of assessing whether | |
| # one piece of experimental data — an outlier — from a set of observations, is likely to be spurious. | |
| # https://en.wikipedia.org/wiki/Chauvenet%27s_criterion | |
| def chauvenet(array): | |
| mean = array.mean() # Mean of incoming array | |
| stdv = array.std() # Standard deviation | |
| N = len(array) # Lenght of incoming array | |
| criterion = 1.0/(2*N) # Chauvenet's criterion | |
| d = abs(array-mean)/stdv # Distance of a value to mean in stdv's | |
| prob = erfc(d) # Area normal dist. | |
| return prob < criterion # Use boolean array outside this function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment