Mercurial > hg > octave-lyh
diff scripts/statistics/tests/cor_test.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/cor_test.m +++ b/scripts/statistics/tests/cor_test.m @@ -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. @@ -33,13 +33,13 @@ ## Only the first character is necessary. ## ## The output is a structure with the following elements: -## pval The p-value of the test. -## stat The value of the test statistic. -## dist The distribution of the test statistic. -## params The parameters of the null distribution of the -## test statistic. -## alternative The alternative hypothesis. -## method The method used for testing. +## pval The p-value of the test. +## stat The value of the test statistic. +## dist The distribution of the test statistic. +## params The parameters of the null distribution of the +## test statistic. +## alternative The alternative hypothesis. +## method The method used for testing. ## ## If no output argument is given, the pval is displayed. @@ -48,7 +48,7 @@ ## Description: Test for zero correlation function t = cor_test (X, Y, ALTERNATIVE, METHOD) - + if ((nargin < 2) || (nargin > 4)) usage ("cor_test (X, Y [, ALTERNATIVE [, METHOD]])") endif @@ -82,7 +82,7 @@ cdf = t_cdf (t.stat, df); elseif (m == "k") tau = kendall (X, Y); - t.method = "Kendall's rank correlation tau"; + t.method = "Kendall's rank correlation tau"; t.params = []; t.stat = tau / sqrt ((2 * (2*n+5)) / (9*n*(n-1))); t.dist = "stdnormal"; @@ -92,7 +92,7 @@ t.method = "Spearman's rank correlation rho"; t.params = []; t.stat = sqrt (n-1) * (rho - 6/(n^3-n)); - t.dist = "stdnormal"; + t.dist = "stdnormal"; cdf = stdnormal_cdf (t.stat); else error ("cor_test: method `%s' not recognized", METHOD) @@ -113,5 +113,5 @@ if (nargout == 0) printf ("pval: %g\n", t.pval); endif - + endfunction