Here Emacs Calc is!
Org-table is based on Calc function.
Calc function vcorr calculates a correlation coefficient among two vectors.
Use vcorr with calc-eval in Emacs Lisp with Org-mode.
A Coefficient-Determination is the same as R-square.
R-square for a simple regression analysis Y on X equals to a squared value of a correlation coefficient between X and Y.
#+CAPTION: My productivity and sleep
#+NAME: MY-TABLE
| Date | sleep | productivity |
|---------+-------+--------------|
| ~[meh]~ | 7.50 | 4.00 |
| ~[meh]~ | 8.00 | 5.00 |
| ~[meh]~ | 8.50 | 6.00 |
| ~[meh]~ | 8.00 | 4.00 |
| ~[meh]~ | 8.20 | 5.00 |
| ~[meh]~ | 8.70 | 6.00 |
When importing lists from Org-table to Emacs Lisp, you can select rows and columns.
:var TMP=MY-TABLE[,1:2] selects for whole rows, with 2nd and 3rd columns.
c.f. http://orgmode.org/manual/var.html
#+BEGIN_SRC emacs-lisp :results value :exports both :var TMP=MY-TABLE[,1:2]
(require 'cl) ;; required for (first) and (second) function.
(setq LST (cddr TMP)) ;; import data to list LST excluding column names and hline.
(setq VEC (apply #'mapcar* #'vector LST)) ;; transpose and change to vector VEC, as Calc accepts vectors only.
(setq X (first VEC)) ;; X is a vector of sleep ('car').
(setq Y (second VEC)) ;; Y is a vector or productivity ('cadr').
(setq VALUE-R ;; correlation coefficient.
(string-to-number ;; calc-eval returns string.
(calc-eval (format "vcorr(%s,%s)" X Y)))) ;; alas, calc-eval accepts only strings.
(setq VALUE-R2 (* VALUE-R VALUE-R)) ;; R-square for a simple regression
#+END_SRC
#+RESULTS:
: 0.8072625698326307
(vvar($2)^2)/(vvar($3)^2)
will give you absolutely unrelated results (seems like Org translates times usinghours * 3600 + minutes * 60 + seconds
formula and then operates on that, so 4 hours squared gives 129600 hours...