generateme / fastmath

Fast primitive based math library
MIT License
228 stars 12 forks source link

add metric adjusted r2 #27

Open behrica opened 5 months ago

behrica commented 5 months ago

I came with this implementation;

(defn adj-r2 [lhs rhs p]
  (let [r2 (stats/r2 lhs rhs)
        n (count lhs)]
    (- 1
       (* (- 1 r2)
          (/ (dec n) (- n p 1))))))

from here: https://en.wikipedia.org/wiki/Coefficient_of_determination#Adjusted_R2

genmeblog commented 5 months ago

There is an omega-sq which is adjusted R2, I can't match results, something is wrong with it I suppose.

genmeblog commented 5 months ago

Ok, I will add a third argument for degrees of freedom (features) to adjust r2. It will be in 3.x.