Skip to content

Commit

Permalink
For cov and cor to use demeaned data
Browse files Browse the repository at this point in the history
  • Loading branch information
rgertenbach authored Jul 13, 2022
1 parent 8331128 commit 870c8f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ local function cov(t1, t2)
local dev2 = map(t2, function(x) return x-mu2 end)

local ss = 0
for i, v in ipairs(t1) do
ss = ss + v * t2[i]
for i, v in ipairs(dev1) do
ss = ss + v * dev2[i]
end

return ss / (#t1 - 1)
Expand Down

0 comments on commit 870c8f8

Please sign in to comment.