Skip to content

onlinestats/online-correlation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

online-correlation

Calculate correlation between two variables

Usage

Online (piece by piece)

const corr = require('online-correlation')
const c = corr()

const a = [1, 3, 2, 5, 8, 7, 12, 2, 4]
const b = [8, 6, 9, 4, 3, 3, 2, 7, 7]

a.forEach((_, i) => {
  c(a[i], b[i])
})

const res = c()
console.log(res) // -0.9069

Arrays (passing arrays)

const corr = require('online-correlation')
const c = corr()

const a = [1, 3, 2, 5, 8, 7, 12, 2, 4]
const b = [8, 6, 9, 4, 3, 3, 2, 7, 7]

const res = c(a, b)
console.log(res) // -0.9069

or

const res = corr()(a, b)

Releases

No releases published

Packages

No packages published