diff m-toolbox/classes/+utils/@math/SKcriticalvalues.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@math/SKcriticalvalues.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,36 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Compute critical values of the Smirnov - Kolmogorov distribution
+% 
+% CALL 
+% 
+% [F,X] = SKcriticalvalues(Y);
+% 
+% 
+% INPUT
+% 
+% - Y, a data series
+% 
+% References:
+%   [1] Leslie H. Miller, Table of Percentage Points of Kolmogorov
+%   Statistics, Journal of the American Statistical Association,
+%   Vol. 51, No. 273 (Mar., 1956), pp. 111-121
+% 
+%
+% L Ferraioli 06-12-2010
+%
+% $Id: SKcriticalvalues.m,v 1.4 2011/03/31 15:38:18 luigi Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function cVal = SKcriticalvalues(n1,n2,alph)
+
+if isempty(n2)
+  n = n1; % test against theoretical distribution
+else
+  n = n1*n2/(n1+n2); % test of two empirical distributions
+end
+A = 0.09037*(-log10(alph)).^1.5 + 0.01515*log10(alph).^2 - 0.08467*alph - 0.11143;
+asympt =  sqrt(-0.5*log(alph)./n); % Smirnov asymptothic formula
+cVal  =  asympt - 0.16693./n - A./n.^1.5;
+end
+