% Dixon tests for outlier % % Description: % % Performs several variants of Dixon test for detecting outlier in % data sample. % % Usage: % % [pval,Q] = dixontest(x,type,opposite,twosided) % % Arguments: % % x: a numeric vector or matrix of data values. Each column of a % matrix is treated as independent sample set. % % opposite: a logical (0,1) indicating whether you want to check not the value % with largest difference from the mean, but opposite (lowest, % if most suspicious is highest etc.). Default 0. % % type: an integer specyfying the variant of test to be performed. % Possible values are compliant with these given by Dixon % (1950): 10, 11, 12, 20, 21. If this value is set to zero, a % variant of the test is chosen according to sample size (10 % for 3-7, 11 for 8-10, 21 for 11-13, 22 for 14 and more). The % lowest or highest value is selected automatically, and can be % reversed used 'opposite' parameter. % % two.sided: treat test as two-sided (default=1). % % Details: % % The p-value is calculating by interpolation using 'dixoncdf' and % 'qtable'. According to Dixon (1951) conclusions, the critical % values can be obtained numerically only for n=3. Other critical % values are obtained by simulations, taken from original Dixon's % paper, and regarding corrections given by Rorabacher (1991). % % Value: % % Q: the value of Dixon Q-statistic. % % pval: the p-value for the test. % % Author(s): % % Lukasz Komsta, ported from R package 'outliers'. % See R News, 6(2):10-13, May 2006 % % References: % % Dixon, W.J. (1950). Analysis of extreme values. Ann. Math. Stat. % 21, 4, 488-506. % % Dixon, W.J. (1951). Ratios involving extreme values. Ann. Math. % Stat. 22, 1, 68-78. % % Rorabacher, D.B. (1991). Statistical Treatment for Rejection of % Deviant Values: Critical Values of Dixon Q Parameter and Related % Subrange Ratios at the 95 percent Confidence Level. Anal. Chem. % 83, 2, 139-146. %