% Chi-squared test for outlier % % Description: % % Performs a chisquared test for detection of one outlier in a % vector. % % Usage: % % [pval,chisq] = chisqouttest(x,variance,opposite) % % Arguments: % % x: a numeric vector of data values. % % variance: known variance of population. if not given, estimator from % sample is taken, but there is not so much sense in such test % (it is similar to z-scores) % % opposite: a logical indicating whether you want to check not the value % with largest difference from the mean, but opposite (lowest, % if most suspicious is highest etc.) % % Details: % % This function performs a simple test for one outlier, based on % chisquared distribution of squared differences between data and % sample mean. It assumes known variance of population. It is % rather not recommended today for routine use, because several more % powerful tests are implemented (see other functions mentioned % below). It was discussed by Dixon (1950) for the first time, as % one of the tests taken into account by him. % % Value: % % chisq: the value of chisquared-statistic. % % pval: the p-value for the test. % % Note: % % This test is known to reject only extreme outliers, if no known % variance is specified. % % 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. % %