This function creates a plot of the cross-quantilogram with confidence intervals. It computes the cross-quantilogram and its confidence intervals using stationary bootstrap, then creates a ggplot visualization of the results.
crossq.plot(
DATA,
vecA,
Kmax,
Bsize,
sigLev = 0.05,
vec.lag,
vec.CQ,
mat.CI,
y.min = -1,
y.max = 1,
ribbon_color = "gray",
ribbon_alpha = 0.8,
bar_color = "black",
bar_width = 0.2,
title = "",
subtitle = NULL
)
A list containing two elements:
A ggplot object representing the cross-quantilogram plot over lags.
A data frame containing cross-quantilogram values and critical values. It includes the following columns:
lag: lag orders.
crossQ: The cross-quantilogram values.
CI_lower: The lower critical values for the confidence interval.
CI_upper: The upper critical values for the confidence interval.
A list containing two elements:
A ggplot object representing the cross-quantilogram plot.
A data frame containing lag values, cross-quantilogram values, and confidence intervals.
A matrix of dimensions T x 2, where T is the number of observations. Column 1 contains the first variable and Column 2 contains the second variable.
A numeric vector of quantiles for the first variable.
An integer representing the maximum lag to compute.
Bootstrap sample size for stationary bootstrap.
Significance level for confidence intervals. Default is 0.05 (95% confidence level).
A vector of lag values (integer values). Not used in computation, only for plotting.
A numeric vector of cross-quantilogram values. Not used in computation, only for plotting.
A matrix with two columns representing the lower and upper bounds of the confidence interval. Not used in computation, only for plotting.
The minimum y-axis value. Default is -1.
The maximum y-axis value. Default is 1.
Color for the confidence interval ribbon. Default is "gray".
Alpha (transparency) for the confidence interval ribbon. Default is 0.8.
Color for the quantilogram bars. Default is "black".
Width of the quantilogram bars. Default is 0.2.
Plot title. Default is an empty string.
Plot subtitle. Default is NULL (no subtitle).
Heejoon Han, Oliver Linton, Tatsushi Oka and Yoon-Jae Whang
Han, H., Linton, O., Oka, T., and Whang, Y. J. (2016). "The cross-quantilogram: Measuring quantile dependence and testing directional predictability between time series." Journal of Econometrics, 193(1), 251-270.
if (FALSE) {
data("sys.risk")
DATA = sys.risk[,c("JPM", "Market")]
vecA = 0.05
Kmax = 20
Bsize = 200
result = crossq.plot(DATA, vecA, Kmax, Bsize)
print(result$plot)
}
Run the code above in your browser using DataLab