p2: add correlation func

This commit is contained in:
leo 2023-02-27 04:08:01 +01:00
parent 9aaf015fac
commit e6fcc5dfbc
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 5 additions and 0 deletions

@ -63,6 +63,7 @@ func run() error {
log.Printf("mutual correlation U,Y: %v", mutCorrelationUY)
log.Printf("mutual correlation Y,U: %v", mutCorrelationYU)
log.Printf("covariance U,Y: %v", cov)
log.Printf("correlation U,Y: %v", stats.Correlation(data[u], data[y]))
log.Printf("len(impulseFunc): %d", len(impulseFunc))
log.Printf("impulseFunc: %v", impulseFunc)

@ -95,6 +95,10 @@ func Covariance(f1, f2 []float64) float64 {
return stat.Covariance(f1, f2, nil)
}
func Correlation(f1, f2 []float64) float64 {
return stat.Correlation(f1, f2, nil)
}
func ImpulseFunction(ruu []float64, ruy []float64) ([]float64, error) {
lruu := len(ruu)