Mercurial > octave
diff scripts/statistics/tests/kolmogorov_smirnov_test_2.m @ 3426:f8dde1807dee
[project @ 2000-01-13 08:40:00 by jwe]
author | jwe |
---|---|
date | Thu, 13 Jan 2000 08:40:53 +0000 |
parents | 781c930425fd |
children | d8b731d3f7a3 |
line wrap: on
line diff
--- a/scripts/statistics/tests/kolmogorov_smirnov_test_2.m Thu Jan 13 08:32:16 2000 +0000 +++ b/scripts/statistics/tests/kolmogorov_smirnov_test_2.m Thu Jan 13 08:40:53 2000 +0000 @@ -1,15 +1,15 @@ ## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## +## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. -## +## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## +## General Public License for more details. +## ## You should have received a copy of the GNU General Public License ## along with this file. If not, write to the Free Software Foundation, ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,7 +22,7 @@ ## respectively, then the null is that F == G. ## ## With the optional argument string alt, the alternative of interest -## can be selected. +## can be selected. ## If alt is "!=" or "<>", the null is tested against the two-sided ## alternative F != G. In this case, the test statistic ks follows a ## two-sided Kolmogorov-Smirnov distribution. @@ -33,16 +33,16 @@ ## ## pval is the p-value of the test. ## -## If no output argument is given, the p-value is displayed. +## If no output argument is given, the p-value is displayed. ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> ## Description: Two-sample Kolmogorov-Smirnov test function [pval, ks] = kolmogorov_smirnov_test_2 (x, y, alt) - + if (nargin < 2 || nargin > 3) usage (strcat ("[pval, ks] = ", - "kolmogorov_smirnov_test_2 (x, y [, tol])")); + "kolmogorov_smirnov_test_2 (x, y [, tol])")); endif if !( is_vector (x) && is_vector (y)) @@ -51,7 +51,7 @@ if (nargin == 2) alt = "!="; - else + else if (! isstr (alt)) error ("kolmogorov_smirnov_test_2: alt must be a string."); endif @@ -76,9 +76,9 @@ pval = exp(- 2 * ks^2); else error (sprintf (["kolmogorov_smirnov_test_2: ", ... - "option %s not recognized"], alt)); + "option %s not recognized"], alt)); endif - + if (nargout == 0) printf (" pval: %g\n", pval); endif