| wccPeakPick | R Documentation |
This function finds the maximum or minimum correlation peak nearest to zero lag for each row in a windowed crosscorrelation matrix.
wccPeakPick(tAllCor=NA, Lsize=8, pspan=.25, type="Max")
tAllCor |
A numeric matrix returned by the |
Lsize |
A numeric value for the required width of the peak (default=8). For instance, |
pspan |
A numeric value used by the loess function to indicate what proportion of data to use in order to do the loess smooth (default=.25). |
type |
A character string (default=‘Max’). ‘Max’ indicates that the maximum correlation closest to zero lag should be picked whereas ‘Min’ indicates that the minimum correlation closest to zero lag should be picked. |
This function operates on the result of wccCalc, a windowed crosscorrelation matrix in order to find the peak correlation closest to a lag of zero. The lag and the value of the peak correlation are returned for each row of the windowed crosscorrelation matrix, i.e., for the elapsed time of each window calculated by wccCalc. The wccCalc windows are sampled at time lagged intervals from one another so that the association between the time series can be estimated even though the time lag of maximum association between the two time series may be itself time varying. For instance, when two individuals converse, their body motions may be associated such that the leader and follower take turns as the two individuals swap roles as speaker and listener.
This same kind of nonstationary association has been observed between many physiological time series. At any particular elapsed time, the maximum correlation closest to a lag of zero (whether a positive or negative lag) is taken to be the lagged offset between the two time series. For series that have oscillatory structure (such as head nodding in conversation) the maximum correlation closest to a lag of zero can be interpreted as the phase lag between the series. The variability in the lag is one measure of the degree of nonstationarity present in the association between two time series.
Returns a list with two vectors: maxIndex is the lag of the peak for each window and maxValue is the calculated correlation at that peak. If wccPeakPick is called with type = ‘Min’ then the returned vectors are named minIndex and minValue. If no peak is found within the row tAllCor[T,] then maxIndex[T] and maxValue[T] are returned as NAs
Boker, S. M., Rotondo, J. L., Xu, M., & King, K. (2002). Windowed cross-correlation and peak picking for the analysis of variability in the association between behavioral time series. Psychological methods, 7(3), 338.
wccCalc for the definition of the windowed crosscorrelation matrix. loess for the definition of the smoothing function.
#Calculate windowed cross correlation between two time series
tSeries1 <- sin(c(1:1000)/10) + rnorm(1000, mean=0, sd=.5)
tSeries2 <- sin(c(1:1000)/15) + rnorm(1000, mean=0, sd=.5)
wccCalcOut <- wccCalc(inSeries1=tSeries1, inSeries2=tSeries2, wMax=50, tMax=50, wInc=1,
tInc=1, method="r")
#Calculate the peak picking vectors
wccPeakPick(wccCalcOut, Lsize=8, pspan=.25, type="Max")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.