corr_lag | R Documentation |
Lag correlation between two variables
corr_lag(
x,
y = x,
lag = 1,
index = NULL,
dates = NULL,
doy_lims,
verbose = FALSE
)
corr_lags(x, y, lags = -5:5, index, dates = NULL, doy_lims, ...)
find_x_lag(x, lag, index)
x , y |
A numeric vector |
lag |
The step of lag time |
index |
A numeric vector, the subscript of x, e.g. |
dates |
Dates vector, dates of x |
doy_lims |
constrain index in the range of |
... |
other parameters to |
cor
: pearson correlation of lag step
lag
:
positive: y is earlier;
negative: x is earlier.
correlation needs to be adjusted because the length of observation is different
## Not run:
# examples
x = sin(1:365)
y = x
index = 1:365
dates = seq(as.Date('2010-01-01'), as.Date('2010-12-31'), 'day')
corr_lags(x, y, index, dates, lag = 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.