changeset 11894:af0adfbd3d16 release-3-0-x

workaround missing roundb
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 08 Dec 2008 07:47:35 +0100
parents 4ccdb0d32158
children a85bde34b8b9
files scripts/statistics/base/__quantile__.m
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/base/__quantile__.m
+++ b/scripts/statistics/base/__quantile__.m
@@ -87,7 +87,12 @@
            ## Used by SAS, method PCTLDEF=2.
            ## http://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/stdize_sect14.htm
 	    t = max (kron (p, m), 1);
-	    t = roundb (t);
+	    # t = roundb (t); 
+	    # roundb unsupported in 3.0.x, so supply a hack
+	    t1 = round (t);
+	    t1m = (abs (t - t1) == 0.5) & (mod (t1, 2) == 1); 
+	    t1 (t1m) += 2 * (t-t1)(t1m);
+	    t = t1;
 	    inv(k,:) = x(t + pcd);
         endswitch