changeset 3792:74c2fc84f0cf

[project @ 2001-02-09 15:56:19 by jwe]
author jwe
date Fri, 09 Feb 2001 15:56:20 +0000
parents c1c532a0acb2
children 56522edd5c33
files scripts/ChangeLog scripts/statistics/distributions/chisquare_cdf.m scripts/statistics/distributions/chisquare_inv.m scripts/statistics/distributions/chisquare_pdf.m scripts/statistics/distributions/chisquare_rnd.m scripts/statistics/distributions/f_cdf.m scripts/statistics/distributions/f_inv.m scripts/statistics/distributions/f_pdf.m scripts/statistics/distributions/f_rnd.m scripts/statistics/distributions/t_cdf.m scripts/statistics/distributions/t_inv.m scripts/statistics/distributions/t_pdf.m scripts/statistics/distributions/t_rnd.m scripts/statistics/tests/welch_test.m
diffstat 14 files changed, 27 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/ChangeLog	Fri Feb 09 15:56:20 2001 +0000
@@ -1,3 +1,21 @@
+2001-02-09  David Livings  <david.livings@asa.co.uk>
+
+	* statistics/tests/welch_test.m: Fix typo.
+
+	* statistics/distributions/chisquare_cdf.m:
+	Don't restrict inputs to be only positive integers.
+	* statistics/distributions/chisquare_inv.m: Likewise.
+	* statistics/distributions/chisquare_pdf.m: Likewise.
+	* statistics/distributions/chisquare_rnd.m: Likewise.
+	* statistics/distributions/f_cdf.m: Likewise.
+	* statistics/distributions/f_inv.m: Likewise.
+	* statistics/distributions/f_pdf.m: Likewise.
+	* statistics/distributions/f_rnd.m: Likewise.
+	* statistics/distributions/t_cdf.m: Likewise.
+	* statistics/distributions/t_inv.m: Likewise.
+	* statistics/distributions/t_pdf.m: Likewise.
+	* statistics/distributions/t_rnd.m: Likewise.
+
 2001-02-08  Paul Kienzle  <pkienzle@kienzle.powernet.co.uk>
 
 	* strings/dec2base.m: New file.
--- a/scripts/statistics/distributions/chisquare_cdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/chisquare_cdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -37,14 +37,4 @@
 
   cdf = gamma_cdf (x, n / 2, 1 / 2);
 
-  ## should we really only allow for positive integer n?
-  k = find (n != round (n));
-  if (any (k))
-    warning ("chisquare_cdf: n should be positive integer");
-    [r, c] = size (x);
-    cdf = reshape (cdf, 1, r * c);
-    cdf(k) = NaN * ones (1, length (k));
-    cdf = reshape (cdf, r, c);
-  endif
-
 endfunction
--- a/scripts/statistics/distributions/chisquare_inv.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/chisquare_inv.m	Fri Feb 09 15:56:20 2001 +0000
@@ -37,14 +37,4 @@
 
   inv = gamma_inv (x, n / 2, 1 / 2);
 
-  ## Allow only for (positive) integer n.
-  k = find (n != round (n));
-  if (any (k))
-    warning ("chisquare_inv: n should be positive integer");
-    [r, c] = size (x);
-    inv = reshape (inv, 1, r * c);
-    inv(k) = NaN * ones (1, length (k));
-    inv = reshape (inv, r, c);
-  endif
-
 endfunction
--- a/scripts/statistics/distributions/chisquare_pdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/chisquare_pdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -37,14 +37,4 @@
 
   pdf = gamma_pdf (x, n / 2, 1 / 2);
 
-  ## should we really only allow for positive integer n?
-  k = find (n != round (n));
-  if (any (k))
-    warning ("chisquare_pdf: n should be positive integer");
-    [r, c] = size (x);
-    pdf = reshape (pdf, 1, r * c);
-    pdf(k) = NaN * ones (1, length (k));
-    pdf = reshape (pdf, r, c);
-  endif
-
 endfunction
--- a/scripts/statistics/distributions/chisquare_rnd.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/chisquare_rnd.m	Fri Feb 09 15:56:20 2001 +0000
@@ -49,12 +49,12 @@
   n = reshape (n, 1, s);
   rnd = zeros (1, s);
 
-  k = find (!(n > 0) | !(n < Inf) | !(n == round (n)));
+  k = find (!(n > 0) | !(n < Inf));
   if (any (k))
     rnd(k) = NaN * ones (1, length (k));
   endif
 
-  k = find ((n > 0) & (n < Inf) & (n == round (n)));
+  k = find ((n > 0) & (n < Inf));
   if (any (k))
     rnd(k) = chisquare_inv (rand (1, length (k)), n(k));
   endif
--- a/scripts/statistics/distributions/f_cdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/f_cdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -57,13 +57,6 @@
     cdf(k) = 1 - betai (n(k) / 2, m(k) / 2, 1 ./ (1 + m(k) .* x(k) ./ n(k)));
   endif
 
-  ## should we really only allow for positive integer m, n?
-  k = find ((m != round (m)) | (n != round (n)));
-  if (any (k))
-    warning ("f_cdf: m and n should be positive integers");
-    cdf(k) = NaN * ones (1, length (k));
-  endif
-
   cdf = reshape (cdf, r, c);
 
 endfunction
--- a/scripts/statistics/distributions/f_inv.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/f_inv.m	Fri Feb 09 15:56:20 2001 +0000
@@ -58,13 +58,6 @@
 	      .* n(k) ./ m(k));
   endif
 
-  ## should we really only allow for positive integer m, n?
-  k = find ((m != round (m)) | (n != round (n)));
-  if (any (k))
-    warning ("f_inv: m and n should be positive integers");
-    inv(k) = NaN * ones (1, length (k));
-  endif
-
   inv = reshape (inv, r, c);
 
 endfunction
\ No newline at end of file
--- a/scripts/statistics/distributions/f_pdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/f_pdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -55,13 +55,6 @@
 	      .* (m(k) ./ n(k)) ./ beta (m(k) / 2, n(k) / 2));
   endif
 
-  ## should we really only allow for positive integer m, n?
-  k = find ((m != round (m)) | (n != round (n)));
-  if (any (k))
-    warning ("f_pdf: m and n should be positive integers");
-    pdf(k) = NaN * ones (1, length (k));
-  endif
-
   pdf = reshape (pdf, r, c);
 
 endfunction
--- a/scripts/statistics/distributions/f_rnd.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/f_rnd.m	Fri Feb 09 15:56:20 2001 +0000
@@ -55,14 +55,14 @@
   n = reshape (n, 1, s);
   rnd = zeros (1, s);
 
-  k = find (!(m > 0) | !(m < Inf) | !(m == round (m)) |
-            !(n > 0) | !(n < Inf) | !(n == round (n)));
+  k = find (!(m > 0) | !(m < Inf) |
+            !(n > 0) | !(n < Inf));
   if (any (k))
     rnd(k) = NaN * ones (1, length (k));
   endif
 
-  k = find ((m > 0) & (m < Inf) & (m == round (m)) &
-            (n > 0) & (n < Inf) & (n == round (n)));
+  k = find ((m > 0) & (m < Inf) &
+            (n > 0) & (n < Inf));
   if (any (k))
     rnd(k) = f_inv (rand (1, length (k)), m(k), n(k));
   endif
--- a/scripts/statistics/distributions/t_cdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/t_cdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -60,13 +60,6 @@
     endif
   endif
 
-  ## should we really only allow for positive integer n?
-  k = find (n != round (n));
-  if (any (k))
-    warning ("t_cdf: n should be positive integer");
-    cdf(k) = NaN * ones (1, length (k));
-  endif
-
   cdf = reshape (cdf, r, c);
 
 endfunction
--- a/scripts/statistics/distributions/t_inv.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/t_inv.m	Fri Feb 09 15:56:20 2001 +0000
@@ -73,13 +73,6 @@
     inv(k) = stdnormal_inv (x(k));
   endif
 
-  ## should we really only allow for positive integer n?
-  k = find (n != round (n));
-  if (any (k))
-    warning ("t_inv: n should be positive integer");
-    inv(k) = NaN * ones (1, length (k));
-  endif
-
   inv = reshape (inv, r, c);
 
 endfunction
\ No newline at end of file
--- a/scripts/statistics/distributions/t_pdf.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/t_pdf.m	Fri Feb 09 15:56:20 2001 +0000
@@ -52,13 +52,6 @@
 	      ./ (sqrt (n(k)) .* beta (n(k)/2, 1/2)));
   endif
 
-  ## should we really only allow for positive integer n?
-  k = find (n != round (n));
-  if (any (k))
-    warning ("t_pdf: n should be positive integer");
-    pdf(k) = NaN * ones (1, length (k));
-  endif
-
   pdf = reshape (pdf, r, c);
 
 endfunction
--- a/scripts/statistics/distributions/t_rnd.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/distributions/t_rnd.m	Fri Feb 09 15:56:20 2001 +0000
@@ -49,12 +49,12 @@
   n = reshape (n, 1, s);
   rnd = zeros (1, s);
 
-  k = find (!(n > 0) | !(n < Inf) | !(n == round (n)));
+  k = find (!(n > 0) | !(n < Inf));
   if (any (k))
     rnd(k) = NaN * ones (1, length (k));
   endif
 
-  k = find ((n > 0) & (n < Inf) & (n == round (n)));
+  k = find ((n > 0) & (n < Inf));
   if (any (k))
     rnd(k) = t_inv (rand (1, length (k)), n(k));
   endif
--- a/scripts/statistics/tests/welch_test.m	Fri Feb 09 15:28:23 2001 +0000
+++ b/scripts/statistics/tests/welch_test.m	Fri Feb 09 15:56:20 2001 +0000
@@ -53,7 +53,7 @@
   mu_x = sum (x) / n_x;
   mu_y = sum (y) / n_y;
   v_x  = sumsq (x - mu_x) / (n_x * (n_x - 1));
-  v_y  = sumsq (x - mu_y) / (n_y * (n_y - 1));
+  v_y  = sumsq (y - mu_y) / (n_y * (n_y - 1));
   c    = v_x / (v_x + v_y);
   df   = 1 / (c^2 / (n_x - 1) + (1 - c)^2 / (n_y - 1));
   t    = (mu_x - mu_y) / sqrt (v_x + v_y);