Pierce's criterion
Run Peirce's criterion to reject data.
Implementation after Ross (2003) using calculation method for table from Wikipedia.
Note that the table that Ross (2003) presents is for R, which is the square root
of what x**2 means in Gould (1855). Also, the first value of Ross (2003) for
three observations, one doubtful value seems to off by a little bit. The rest of the
table agrees well.
To import:
peirce_criterion(n_tot, n, m=1)
Peirce's criterion
Returns the threshold error deviation for outlier identification using Peirce's criterion based on Gould's methodology. This routine is heavily copied from Wikipedia
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_tot
|
int
|
Total number of observations. |
required |
n
|
int
|
Number of outliers to be removed. |
required |
m
|
int
|
Number of model unknowns, defaults to 1. |
1
|
Returns:
| Type | Description |
|---|---|
float
|
Error threshold |
Source code in src/rttools/peirce.py
reject_outliers(data, m=1)
Applies Peirce's criterion to reject outliers.
Algorithm implmeneted as given by Ross (2003).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
All data points. |
required |
m
|
int
|
Number of model unknowns, defaults to 1. |
1
|
Returns:
| Type | Description |
|---|---|
Tuple[float, float, ndarray]
|
New average and standard deviation, Array with the outliers. |