cont_test: Test for financial contagion

Description Usage Arguments Details Value References Examples

View source: R/contagion.R

Description

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

Usage

1
2
3
4
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

Details

This function is an implementation of the test for financial contagion developed by Støve, Tjø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.

Value

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

References

Støve, Bård, Dag Tjø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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
   # 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)
   
## End(Not run)

lg documentation built on Dec. 5, 2019, 5:13 p.m.

Related to cont_test in lg...