kleinbub / rMEA

an R package to perform synchronization analysis on motion energy time-series
GNU General Public License v3.0
15 stars 2 forks source link

MEAccf() gives some correlation values greater than 1 #14

Closed krisanathema closed 11 months ago

krisanathema commented 11 months ago

Hi,

I used MEAccf() to get the complete cross-correlation table over all authorized lags and windows. The code I used is the following: MEA_ccf_ABS <- MEAccf(ScaledMEAobject, lagSec = 5, winSec = 30, incSec = 30, r2Z = TRUE, ABS = TRUE)

I wanted to gather the maximal cross-correlation for each window, which I obtained with (for the first window of the first dyad): max(MEA_ccf_ABS[[1]]$ccf[1, ])

I got a few cases where this maximal value is greated than 1. However, I thought that cross-correlations could only span the range [-1, 1]. Is there any normalization step that I missed to get cross-correlations in the range [-1, 1] from the MEAccf() output?

Many thanks in advance :-)

kleinbub commented 11 months ago

Hi, with the (default) flag r2Z = TRUE there is a transformation from Pearson correlation r values to Fisher's Z values ( https://en.wikipedia.org/wiki/Fisher_transformation ) which can reach values higher than 1. This transformation improves the distribution properties of r, and is active by default due to it being the traditional procedure employed in Ramseyer & Tschacher 2011 and subsequent replications. You can turn it to FALSE to have raw untransformed correlations.