Home > freetb4matlab > outliers > grubbsinv.m

grubbsinv

PURPOSE ^

% Calculate critical values and p-values for Grubbs tests

SYNOPSIS ^

function [q]=grubbsinv(p, n, type, rev)

DESCRIPTION ^

% Calculate critical values and p-values for Grubbs tests
% 
% Description:
% 
%      This function is designed to calculate critical values for Grubbs
%      tests for outliers detecting and to approximate p-values
%      reversively.
% 
% Usage:
% 
%      [q]=grubbsinv(p, n, type, rev) 
% 
% Arguments:
% 
%        p: vector of probabilities. 
% 
%        n: sample size. 
% 
%     type: Integer value indicating test variant. 10 is a test for one
%           outlier (side is detected automatically and can be reversed
%           by 'opposite' parameter). 11 is a test for two outliers on
%           opposite tails, 20 is test for two outliers in one tail. 
% 
%      rev: if set to TRUE, function 'grubbsinv' acts as 'grubbscdf' (grubbscdf
%           is really wrapper to grubbsinv to omit repetition of the code).
% 
% Details:
% 
%      The critical values for test for one outlier is calculated
%      according to approximations given by Pearson and Sekar (1936). The
%      formula is simply reversed to obtain p-value.
% 
%      The values for two outliers test (on opposite sides) are
%      calculated according to David, Hartley, and Pearson (1954). Their
%      formula cannot be rearranged to obtain p-value, thus such values
%      are obtained by simple bisection method.
% 
%      For test checking presence of two outliers at one tail, the
%      tabularized distribution (Grubbs, 1950) is used, and
%      approximations of p-values are interpolated using 'qtable'.
% 
% Value:
% 
%      A vector of quantiles or p-values.
% 
% Author(s):
% 
%      Lukasz Komsta, ported from R package 'outliers'.
%    See R News, 6(2):10-13, May 2006
% 
% References:
% 
%      Grubbs, F.E. (1950). Sample Criteria for testing outlying
%      observations. Ann. Math. Stat. 21, 1, 27-58.
% 
%      Pearson, E.S., Sekar, C.C. (1936). The efficiency of statistical
%      tools and a criterion for the rejection of outlying observations.
%      Biometrika, 28, 3, 308-320.
% 
%      David, H.A, Hartley, H.O., Pearson, E.S. (1954). The distribution
%      of the ratio, in a single normal sample, of range to standard
%      deviation. Biometrika, 41, 3, 482-493.
% 
%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003