Apply Peirce's criterion for outlier detection for arbitrary number of observations (≥3). Gould's implementation of Peirce's method is used. This implementation doesn't use lookup tables unlike the other submission and computes the R ratios using Gould's formulae. Hence the application is NOT limited to 60 observations -the size of the limited lookup table from  ROSS' paper.
Input DELTAS is a vector of the observations (or fit errors). Optional second input NUM_UNKNOWS is the number of "unknown quantities". Default value is 1 which is generally the case as argued by the authors. The function returns linear indices of outliers (OUTLIERINDICES), linear indices of observations which are found to be worthy of keeping (INLIERINDICES), and actual observations that are flagged as outliers.
This example is from Peirce's original 1852 publication. Observations 1.01 and -1.4 are flagged as outliers.
z = [-0.3 0.48 0.63 -0.22 0.18 -0.44 -0.24 -0.13 -0.05 0.39 1.01 0.06 -1.4 0.2 0.1];
>> [outlierIdx,inlierIdx,outlierObs] = peirces(z)
1 2 3 4 5 6 7 8 9 10 12 14 15
B.A.Gould (1855), ON PEIRCEâ€™S CRITERION FOR THE REJECTION OF DOUBTFUL OBSERVATIONS, WITH TABLES FOR FACILITATING ITS APPLICATION. The Astronomical Journal, No.83, Vol. IV.
B.PEIRCE (1852), CRITERION FOR THE REJECTION OF DOUBTFUL OBSERVATIONS. The Astronomical Journal, No.45, Vol. II.
S.M.ROSS, (2003) Peirce's criterion for the elimination of suspect experimental data. Journal of Engineering Technology.