Skip to contents

cor(x - mean(x), y - mean(y)) with explicit zero-norm guard.

Usage

morie_dsp_baseline_correlation(x, y)

Arguments

x

Numeric vector.

y

Numeric vector.

Value

Scalar in [-1, 1].

References

Rangayyan & Krishnan (2015), Ch. 5.

Examples

set.seed(1)
x <- rnorm(100)
morie_dsp_baseline_correlation(x, x)  # identical inputs: 1
#> [1] 1