Learn R Programming

quantilogram (version 3.1.1)

crossq.plot: Plot of Cross-Quantilogram

Description

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.

Usage

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
)

Value

A list containing two elements:

plot

A ggplot object representing the cross-quantilogram plot over lags.

df.res

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:

plot

A ggplot object representing the cross-quantilogram plot.

df.res

A data frame containing lag values, cross-quantilogram values, and confidence intervals.

Arguments

DATA

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.

vecA

A numeric vector of quantiles for the first variable.

Kmax

An integer representing the maximum lag to compute.

Bsize

Bootstrap sample size for stationary bootstrap.

sigLev

Significance level for confidence intervals. Default is 0.05 (95% confidence level).

vec.lag

A vector of lag values (integer values). Not used in computation, only for plotting.

vec.CQ

A numeric vector of cross-quantilogram values. Not used in computation, only for plotting.

mat.CI

A matrix with two columns representing the lower and upper bounds of the confidence interval. Not used in computation, only for plotting.

y.min

The minimum y-axis value. Default is -1.

y.max

The maximum y-axis value. Default is 1.

ribbon_color

Color for the confidence interval ribbon. Default is "gray".

ribbon_alpha

Alpha (transparency) for the confidence interval ribbon. Default is 0.8.

bar_color

Color for the quantilogram bars. Default is "black".

bar_width

Width of the quantilogram bars. Default is 0.2.

title

Plot title. Default is an empty string.

subtitle

Plot subtitle. Default is NULL (no subtitle).

Author

Heejoon Han, Oliver Linton, Tatsushi Oka and Yoon-Jae Whang

References

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.

Examples

Run this code
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