changeset 14342:2cd56a5e3a66 stable

new tests * ols.m: New tests.
author John W. Eaton <jwe@octave.org>
date Tue, 07 Feb 2012 11:41:33 -0500
parents 71efccec5936
children acc26b860afa 95c43fc8dbe1
files scripts/statistics/base/ols.m
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/base/ols.m	Tue Feb 07 11:34:55 2012 -0500
+++ b/scripts/statistics/base/ols.m	Tue Feb 07 11:41:33 2012 -0500
@@ -141,6 +141,27 @@
 %! x = [x, ones(5,1)];
 %! assert (ols(y,x), [3; 2], 50*eps)
 
+%!test
+%! x = [1, 2; 3, 4];
+%! y = [1; 2];
+%! [b, s, r] = ols (x, y);
+%! assert (b, [1.4, 2], 2*eps);
+%! assert (s, [0.2, 0; 0, 0], 2*eps);
+%! assert (r, [-0.4, 0; 0.2, 0], 2*eps);
+
+%!test
+%! x = [1, 2; 3, 4];
+%! y = [1; 2];
+%! [b, s] = ols (x, y);
+%! assert (b, [1.4, 2], 2*eps);
+%! assert (s, [0.2, 0; 0, 0], 2*eps);
+
+%!test
+%! x = [1, 2; 3, 4];
+%! y = [1; 2];
+%! b = ols (x, y);
+%! assert (b, [1.4, 2], 2*eps);
+
 %% Test input validation
 %!error ols ();
 %!error ols (1);