Description Usage Arguments Value Examples
Calculate the rolling window correlations.
1 2 3 4 5 6 7 |
x, y |
Two vectors or two zoo objects. For zoo objects, if their time ranges is different, intersection will be used. |
... |
Other arguments for function cor. |
width |
The width of the sliding window, which must be odd number. |
show |
If TRUE, the result will be plotted. |
rollcor.default
return a vector, and rollcor.zoo
return a "zoo
" object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | x <- 1 : 100
y <- 2 * x + rnorm(100, 0, 10)
rollcor(x, y, width = 21)
xz <- zoo(x)
yz <- zoo(y)
rollcor(xz, yz, width = 21)
rollcor(xz, yz, width = 21, show = FALSE)
x <- 1 : 100
y <- 2 * x + rnorm(100, 0, 10)
x <- zoo(x, order.by = 10 : 109)
y <- zoo(y, order.by = -3 : 96)
rollcor(x, y, width = 21, method = 'kendall')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.