changeset 6701:3933e0693fe0

[project @ 2007-06-12 21:25:51 by jwe]
author jwe
date Tue, 12 Jun 2007 21:25:51 +0000
parents b55d109ffe7e
children b2391d403ed2
files scripts/ChangeLog scripts/plot/errorbar.m scripts/statistics/tests/wilcoxon_test.m scripts/strings/strmatch.m
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Jun 12 20:51:47 2007 +0000
+++ b/scripts/ChangeLog	Tue Jun 12 21:25:51 2007 +0000
@@ -1,3 +1,7 @@
+2007-06-12  Steve M. Robbins  <steve@sumost.ca>
+
+	* statistics/tests/wilcoxon_test.m: Error if N <= 25.
+
 2007-06-12  Søren Hauberg  <soren@hauberg.org>
 
 	* plot/fplot.m: If function is inline, vectorize it.
--- a/scripts/plot/errorbar.m	Tue Jun 12 20:51:47 2007 +0000
+++ b/scripts/plot/errorbar.m	Tue Jun 12 21:25:51 2007 +0000
@@ -35,7 +35,7 @@
 ## If more than two arguments are given, they are interpreted as
 ##
 ## @example
-## errorbar (@var{x}, @var{y}, ..., @var{fmt}, ...)
+## errorbar (@var{x}, @var{y}, @dots{}, @var{fmt}, @dots{})
 ## @end example
 ##
 ## @noindent
--- a/scripts/statistics/tests/wilcoxon_test.m	Tue Jun 12 20:51:47 2007 +0000
+++ b/scripts/statistics/tests/wilcoxon_test.m	Tue Jun 12 21:25:51 2007 +0000
@@ -22,7 +22,10 @@
 ## For two matched-pair sample vectors @var{x} and @var{y}, perform a
 ## Wilcoxon signed-rank test of the null hypothesis PROB (@var{x} >
 ## @var{y}) == 1/2.  Under the null, the test statistic @var{z}
-## approximately follows a standard normal distribution.
+## approximately follows a standard normal distribution when @var{n} > 25.
+##
+## @strong{Warning}: This function assumes a normal distribution for @var{z}
+## and thus is invalid for @var{n} <= 25.
 ##
 ## With the optional argument string @var{alt}, the alternative of
 ## interest can be selected.  If @var{alt} is @code{"!="} or
@@ -42,7 +45,7 @@
 
 function [pval, z] = wilcoxon_test (x, y, alt)
 
-  if ((nargin < 2) || (nargin > 3))
+  if (nargin < 2 || nargin > 3)
     print_usage ();
   endif
 
@@ -56,12 +59,12 @@
   d = x - y;
   d = d (find (d != 0));
   n = length (d);
-  if (n > 0)
+  if (n > 25)
     r = ranks (abs (d));
     z = sum (r (find (d > 0)));
     z = ((z - n * (n + 1) / 4) / sqrt (n * (n + 1) * (2 * n + 1) / 24));
   else
-    z = 0;
+    error ("wilcoxon_test: implementation requires more than 25 different pairs");
   endif
 
   cdf = stdnormal_cdf (z);
--- a/scripts/strings/strmatch.m	Tue Jun 12 20:51:47 2007 +0000
+++ b/scripts/strings/strmatch.m	Tue Jun 12 21:25:51 2007 +0000
@@ -20,7 +20,7 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} strmatch (@var{s}, @var{a}, "exact")
-## Return true for entries of @var{a} that match the string @var{s}.
+## Return indices of entries of @var{a} that match the string @var{s}.
 ## The second argument @var{a} may be a string matrix or a cell array of
 ## strings.  If the third argument @code{"exact"} is not given, then
 ## @var{s} only needs to match @var{a} up to the length of @var{s}.  Nul