Home > freetb4matlab > statistics > anderson_darling_test.m

anderson_darling_test

PURPOSE ^

% anderson_darling_test (@var{x}, @var{distribution})

SYNOPSIS ^

function [q,Asq,info] = anderson_darling_test(x,dist)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {[@var{q}, @var{Asq}, @var{info}] = } = @
% anderson_darling_test (@var{x}, @var{distribution})
%
% Test the hypothesis that @var{x} is selected from the given distribution
% using the Anderson-Darling test.  If the returned @var{q} is small, reject
% the hypothesis at the @var{q}*100% level.
%
% The Anderson-Darling @math{@var{A}^2} statistic is calculated as follows:
%
% @example
% @iftex
% A^2_n = -n - \sum_{i=1}^n (2i-1)/n log(z_i (1-z_{n-i+1}))
% @end iftex
% @ifnottex
%               n
% A^2_n = -n - SUM (2i-1)/n log(@math{z_i} (1 - @math{z_@{n-i+1@}}))
%              i=1
% @end ifnottex
% @end example
%
% where @math{z_i} is the ordered position of the @var{x}'s in the CDF of the 
% distribution.  Unlike the Kolmogorov-Smirnov statistic, the 
% Anderson-Darling statistic is sensitive to the tails of the 
% distribution.
%
% The @var{distribution} argument must be a either @t{'uniform'}, @t{'normal'},
% or @t{'exponential'}.
%
% For @t{'normal'}' and @t{"exponential"} distributions, estimate the 
% distribution parameters from the data, convert the values 
% to CDF values, and compare the result to tabluated critical 
% values.  This includes an correction for small @var{n} which 
% works well enough for @var{n} >= 8, but less so from smaller @var{n}.  The
% returned @code{info.Asq_corrected} contains the adjusted statistic.
%
% For @t{'uniform'}, assume the values are uniformly distributed
% in (0,1), compute @math{@var{A}^2} and return the corresponding @math{p}-value from
% @code{1-anderson_darling_cdf(A^2,n)}.
% 
% If you are selecting from a known distribution, convert your 
% values into CDF values for the distribution and use @t{'uniform'}.
% Do not use @t{'uniform'} if the distribution parameters are estimated 
% from the data itself, as this sharply biases the @math{A^2} statistic
% toward smaller values.
%
% [1] Stephens, MA; (1986), 'Tests based on EDF statistics', in
% D'Agostino, RB; Stephens, MA; (eds.) Goodness-of-fit Techinques.
% New York: Dekker.
%
% @seealso{anderson_darling_cdf}
% @end deftypefn

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003