Description Usage Arguments Value Author(s) References Examples

Calculates the detrended cross-covariance between two time series *y1* and *y2*.

1 |

`y1, y2` |
vectors corresponding to the time series data. If |

`m` |
an integer or integer valued vector indicating the size (or sizes) of the window for the polinomial fit. |

`nu` |
a non-negative integer denoting the degree of the polinomial fit applied on the integrated series. |

`overlap` |
logical: if true (the default), uses overlapping windows. Otherwise, non-overlapping boxes are applied. |

A vector of size *length(m)* containing the detrended cross-covariance considering windows of size *m+1*, for each *m* supplied.

Taiane Schaedler Prass

Prass, T.S. and Pumi, G. (2019). On the behavior of the DFA and DCCA in trend-stationary processes <arXiv:1910.10589>.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | ```
# Simple usage
y1 = rnorm(100)
y2 = rnorm(100)
F.dcca = Fdcca(y1, y2, m = 3, nu = 0, overlap = TRUE)
F.dcca
# A simple example where y1 and y2 are independent.
ms = 3:50
F.dcca1 = Fdcca(y1, y2, m = ms, nu = 0, overlap = TRUE)
F.dcca2 = Fdcca(y1, y2, m = ms, nu = 0, overlap = FALSE)
plot(ms, F.dcca1, type = "o", xlab = "m", col = "blue",
ylim = c(min(F.dcca1,F.dcca2),max(F.dcca1,F.dcca2)),
ylab = expression(F[DCCA]))
points(ms, F.dcca2, type = "o", col = "red")
legend("bottomright", legend = c("overlapping","non-overlapping"),
col = c("blue", "red"), lty= 1, bty = "n", pch=1)
# A more elaborated example where y1 and y2 display cross-correlation for non-null lags.
# This example also showcases why overlapping windows are usually advantageous.
# The data generating process is the following:
# y1 is i.i.d. Gaussian while y2 is an MA(2) generated from y1.
n = 500
ms = 3:50
theta = c(0.4,0.5)
# Calculating the expected value of the DCCA in this scenario
m_max = max(ms)
vtheta = c(1,theta, rep(0, m_max - length(theta)))
G12 = matrix(0, ncol = m_max+1, nrow = m_max+1)
for(t in 1:(m_max+1)){
for(h in 0:(m_max+1-t)){
G12[t,t+h] = vtheta[h+1]
}
}
EF.dcca = EFdcca(m = ms, nu = 0, G = G12)
# generating the series and calculating the DCCA
burn.in = 100
eps = rnorm(burn.in)
y1 = rnorm(n)
y2 = arima.sim(model = list(ma = theta), n, n.start = burn.in, innov = y1, start.innov = eps)
ms = 3:50
OF.dcca = Fdcca(y1, y2, m = ms, nu = 0, overlap = TRUE)
NOF.dcca = Fdcca(y1, y2, m = ms, nu = 0, overlap = FALSE)
plot(ms, OF.dcca, type = "o", xlab = "m", col = "blue",
ylim = c(min(NOF.dcca,OF.dcca,EF.dcca),max(NOF.dcca,OF.dcca,EF.dcca)),
ylab = expression(F[DCCA]))
points(ms, NOF.dcca, type = "o", col = "darkgreen")
points(ms, EF.dcca, type = "o", col = "red")
legend("bottomright", legend = c("overlapping","non-overlapping","expected"),
col = c("blue", "darkgreen","red"), lty= 1, bty = "n", pch=1)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.