choose_lag: Lag IMFs

Description Usage Arguments Details Value Examples

View source: R/emdr1.R

Description

This function lags the all series in x according to their cross- correlation with y.

Usage

1
choose_lag(x, y, lag.max = 0.5)

Arguments

x

Array containing the IMFs to lag.

y

vector containing the response with which to maximize the correlation.

lag.max

The maximum lag to consider relatively to the mean period of each IMF.

Details

In this function, the lag is determined automatically for each IMF in x. The lag chosen is the one maximizing the cross-correlation (in absolute value) between the IMF and y.

For each IMF in x, the maximum lag considered in the search is lag.max * IMF period (rounded). For example, for an IMF of mean period 10 and lag.max = 0.5, the maximum lag considered is 5.

Value

An array with the same dimensions as x containing the lagged IMFs. In addition contains an attribute lag storing the lags chosen for each IMF.

Examples

1
2
   choose_lag(cos(3:22), cos(1:20))
   choose_lag(cos(2:21), cos(1:20))

PierreMasselot/Library--emdr documentation built on June 19, 2021, 8:58 a.m.