diff scripts/statistics/tests/cor_test.m @ 20038:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children d9341b422488
line wrap: on
line diff
--- a/scripts/statistics/tests/cor_test.m
+++ b/scripts/statistics/tests/cor_test.m
@@ -67,11 +67,11 @@
 
 function t = cor_test (x, y, alt, method)
 
-  if ((nargin < 2) || (nargin > 4))
+  if (nargin < 2 || nargin > 4)
     print_usage ();
   endif
 
-  if (!isvector (x) || !isvector (y) || length (x) != length (y))
+  if (! isvector (x) || ! isvector (y) || length (x) != length (y))
     error ("cor_test: X and Y must be vectors of the same length");
   endif
 
@@ -88,7 +88,7 @@
   endif
 
   n = length (x);
-  m = method (1);
+  m = method(1);
 
   if (m == "p")
     r = corr (x, y);
@@ -97,7 +97,7 @@
     t.params = df;
     t.stat = sqrt (df) .* r / sqrt (1 - r.^2);
     t.dist = "t";
-    cdf  = tcdf (t.stat, df);
+    cdf = tcdf (t.stat, df);
   elseif (m == "k")
     tau = kendall (x, y);
     t.method = "Kendall's rank correlation tau";