Learn R Programming

lg (version 0.4.1)

cont_test: Test for financial contagion

Description

Test for financial contagion by means of the local Gaussian correlation.

Usage

cont_test(lg_object_nc, lg_object_c,
  grid_range = quantile(rbind(lg_object_nc$x, lg_object_c$x), c(0.05,
  0.95)), grid_length = 30, n_rep = 1000, weight = function(y) {    
  rep(1, nrow(y)) })

Arguments

lg_object_nc

An object of type lg, as produced by the lg_main-function for the observations covering the non-crisis period. The data must be two dimensional.

lg_object_c

An object of type lg, as produced by the lg_main-function for the observations covering the crisis period. The data must be two dimensional.

grid_range

This test measures the local correlations a long the diagonal specified by this vector of length two.

grid_length

The number of grid points.

n_rep

The number of bootstrap replicates.

weight

Weight function

Value

A list containing the test result as well as various parameters. The elements are:

  • observed The observed value of the test statistic.

  • replicated The replicated values of the test statistic.

  • p_value The p-value of the test.

  • local_correlations The local correlations measured along the diagonal, for the non-crisis and crisis periods respectively.

Details

This function is an implementation of the test for financial contagion developed by St<U+00F8>ve, Tj<U+00F8>stheim and Hufthammer (2013). They test whether the local correlations between two financial time series are different before and during crisis times. The distinction between crisis and non-crisis times must be made by the user.

References

St<U+00F8>ve, B<U+00E5>rd, Dag Tj<U+00F8>stheim, and Karl Ove Hufthammer. "Using local Gaussian correlation in a nonlinear re-examination of financial contagion." Journal of Empirical Finance 25 (2014): 62-82.

Examples

Run this code
# NOT RUN {
   # Run the test on some built-in stock data
   data(EuStockMarkets)
   x <- apply(EuStockMarkets, 2, function(x) diff(log(x)))[, 1:2]

   # Define the crisis and non-crisis periods (arbitrarily for this simple
   # example)
   non_crisis <- x[1:100, ]
   crisis     <- x[101:200, ]

   # Create the lg-objects, with parameters that match the applications in the
   # original publication describibg the test
   lg_object_nc <- lg_main(non_crisis, est_method = "5par",
                           transform_to_marginal_normality = FALSE)
   lg_object_c  <- lg_main(crisis, est_method = "5par",
                           transform_to_marginal_normality = FALSE)

   
# }
# NOT RUN {
   # Run the test (with very few resamples for illustration)
   test_result <- cont_test(lg_object_nc, lg_object_c,
                            n_rep = 10)
   
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab