Function: org-columns--summary-estimate

org-columns--summary-estimate is a byte-compiled function defined in org-colview.el.gz.

Signature

(org-columns--summary-estimate ESTIMATES _)

Documentation

Combine a list of estimates, using mean and variance.

The mean and variance of the result will be the sum of the means and variances (respectively) of the individual estimates.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
(defun org-columns--summary-estimate (estimates _)
  "Combine a list of estimates, using mean and variance.
The mean and variance of the result will be the sum of the means
and variances (respectively) of the individual estimates."
  (let ((mean 0)
        (var 0))
    (dolist (e estimates)
      (pcase (mapcar #'string-to-number (split-string e "-"))
	(`(,low ,high)
	 (let ((m (/ (+ low high) 2.0)))
	   (cl-incf mean m)
	   (cl-incf var (- (/ (+ (* low low) (* high high)) 2.0) (* m m)))))
	(`(,value) (cl-incf mean value))))
    (let ((sd (sqrt var)))
      (format "%s-%s"
	      (format "%.0f" (- mean sd))
	      (format "%.0f" (+ mean sd))))))