wisp
 
(Arne Babenhauserheide)
2016-11-08: refactor for readability and to avoid copy-paste

refactor for readability and to avoid copy-paste

diff --git a/examples/ensemble-estimation.w b/examples/ensemble-estimation.w
--- a/examples/ensemble-estimation.w
+++ b/examples/ensemble-estimation.w
@@ -303,21 +303,22 @@ define : main args
               flatten y-deviations
         y-stds : list-ec (: i y-deviations) : apply standard-deviation-from-deviations i
         y^b-stds : list-ec (: i y^b-deviations) : apply standard-deviation-from-deviations i
+        Δ/σ
+          list-ec (: i (length x-opt))
+                   / : - (list-ref x-opt i) (list-ref x^true i)
+                       apply standard-deviation-from-deviations : list-ec (: j x-deviations) : list-ref j i
       format #t "x⁰:    ~A\n    ± ~A\nx:     ~A\n    ± ~A\nx^t:   ~A\nx-t/σ: ~A\nΣ̅|Δ/σ|:~A\ny̅:     ~A ± ~A\ny̅⁰:    ~A ± ~A\ny̅^t:   ~A\nnoise: ~A\n" 
                  . x^b
                  list-ec (: i (length x^b)) : list-ref (list-ref P i) i
                  . x-opt 
                  . x-std
                  . x^true
-                 list-ec (: i (length x-opt)) 
-                   / : - (list-ref x-opt i) (list-ref x^true i)
-                       apply standard-deviation-from-deviations : list-ec (: j x-deviations) : list-ref j i
-                 sum-ec (: i (length x-opt))
-                  sqrt
-                   expt
-                     / : - (list-ref x-opt i) (list-ref x^true i)
-                         apply standard-deviation-from-deviations : list-ec (: j x-deviations) : list-ref j i
-                     . 2
+                 . Δ/σ
+                 mean
+                   list-ec (: i (length x-opt))
+                     sqrt
+                       expt : list-ref Δ/σ i
+                            . 2
                  mean : map (lambda (x) (H x-opt x)) y⁰-pos
                  . y-std
                      ; list-ec (: i (length y-opt))