dacf_curve: Distance Dependogram

View source: R/dcor_serial_test.R

dacf_curveR Documentation

Distance Dependogram

Description

Computes lagwise distance covariance or distance correlation values for a univariate or multivariate time series and returns an object that can be plotted as a dependogram using plot().

Usage

dacf_curve(
  x,
  transform = c("none", "bowl", "biloop"),
  measure = c("dcov", "dcor"),
  lags = NULL,
  block_size = NULL,
  ...
)

Arguments

x

A numeric vector or numeric matrix containing a time series. If x is a matrix, rows are interpreted as time points and columns as components.

transform

Character string indicating whether the data should be transformed before computing the lagwise dependence measure. One of "none", "bowl", or "biloop".

measure

Character string specifying the lagwise dependence measure. Either "dcov" for distance covariance or "dcor" for distance correlation. The default is "dcov".

lags

Integer vector of lags to compute. If NULL, the default is 1:floor(n^(2/5)).

block_size

Either NULL or one positive integer. If NULL, the standard full computation is used. If positive, the blockwise computation is used with that block size.

...

Additional arguments passed to bowl_transform() or biloop_transform() when transform is not "none".

Details

The function computes either \mathrm{dCov}(X_t, X_{t+k}) or \mathrm{dCor}(X_t, X_{t+k}) for each lag k. The choice is controlled by measure.

If block_size = NULL, the standard full pairwise-distance computation is used at each lag. If block_size is positive, a blockwise computation is used. The block size does not need to divide n - k; the final block may be smaller.

If transform = "bowl" or transform = "biloop", the transformation is applied before computing the lagwise distance autocorrelations. For multivariate input, "biloop" is allowed but is generally not recommended.

The returned object is compatible with plot.sdt(), so the lagwise values can be shown as a barplot or line plot in the same style as the dependograms produced by dcor_serial_test() and hsic_serial_test().

Value

An object of class "sdt" containing the lagwise dependence values in estimate. It can be plotted with plot().

Examples

x <- as.numeric(arima.sim(list(ar = 0.6), n = 200))
fit <- dacf_curve(x, lags = 1:10)
plot(fit)

y <- as.numeric(arima.sim(list(ar = 0.6), n = 200))
fit2 <- dacf_curve(y, lags = 1:10, block_size = 64L)
plot(fit2, type = "line")

# Multivariate example
set.seed(1)
X <- cbind(
  as.numeric(arima.sim(list(ar = 0.5), n = 200)),
  as.numeric(arima.sim(list(ar = -0.3), n = 200))
)
fit3 <- dacf_curve(X, lags = 1:8)
plot(fit3)


dcorBSS documentation built on Nov. 10, 2026, 5:07 p.m.