changeset 10523:e74bff13aa26

improve stdnormal_cdf accuracy by using erfc (bug #29543)
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 15 Apr 2010 21:10:07 +0200
parents 6538ff562949
children 1c6ff93c025a
files scripts/ChangeLog scripts/statistics/distributions/stdnormal_cdf.m
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Apr 14 22:15:34 2010 +0300
+++ b/scripts/ChangeLog	Thu Apr 15 21:10:07 2010 +0200
@@ -1,3 +1,7 @@
+2010-04-15  Jaroslav Hajek  <highegg@gmail.com>
+
+	* statistics/distributions/stdnormal_cdf.m: Calculate using erfc.
+
 2010-04-13  David Bateman  <dbateman@free.fr>
 
 	* statistics/discrete_cdf.m: Reimplement using lookup.
--- a/scripts/statistics/distributions/stdnormal_cdf.m	Wed Apr 14 22:15:34 2010 +0300
+++ b/scripts/statistics/distributions/stdnormal_cdf.m	Thu Apr 15 21:10:07 2010 +0200
@@ -37,7 +37,7 @@
     error ("stdnormal_cdf: x must not be empty");
   endif
 
-  cdf = (ones (sz) + erf (x / sqrt (2))) / 2;
+  cdf = erfc (x / (-sqrt(2))) / 2;
 
 endfunction