3.5.3.1.35 MovCoef

Description

This function takes two vectors and returns a vector of moving correlation coefficientsof adjacent ranges [i-back, i+forward], for a point i. The part of range beyond the input vector is dropped.

\frac{\overline{v_1v_2}-\bar{v_1}\bar{v_2}}{\sqrt{(\bar{v_1^2}-\bar{v_1}\bar{v_1})(\bar{v_2^2}-\bar{v_2}\bar{v_2})}}

within the window [i-back, i+forward]

Syntax

Movcoef(v1,v2,back,forward)

Parameters

v1

A data vector

v2

A second data vector

back

Backward window. At any given i, backward window is defined by i - back.

forward

Forward window. At any given i, forward window is defined by i + forward.

Return

Return the moving correlation vector.

Example

MovCoef(col(2), col(3), 20, 0);