This vignette reproduces the
headline empirical results of the Scale-Ordered Contagion paper on the
bundled G20 equity returns. The light steps run here; the heavier
all-pairs and bootstrap steps are shown with eval = FALSE
and run in a few minutes on a laptop.
data(g20_returns)
data(market_groups)
dim(g20_returns)
#> [1] 5036 18
usa_india <- wqte_profile(g20_returns, "USA", "India", tau = 0.05)
india_usa <- wqte_profile(g20_returns, "India", "USA", tau = 0.05)
round(rbind(`USA->India` = usa_india, `India->USA` = india_usa), 4)
#> [,1] [,2] [,3] [,4] [,5]
#> USA->India 0.0155 0.0425 0.0491 0.0494 0.0567
#> India->USA 0.0063 0.0268 0.0449 0.0220 0.0425The United-States-to-India profile rises through d4 (the fast-source / slow-receiver signature of SOCH-A) and exceeds the reverse direction in level (SOCH-C):
all(diff(usa_india[1:4]) > 0) # rising d1 -> d4
#> [1] TRUE
mean(usa_india) > mean(india_usa) # level asymmetry
#> [1] TRUE
plot_scale_profiles(list(`USA->India` = usa_india, `India->USA` = india_usa))adv <- c("USA", "UK", "Germany", "Japan")
emg <- c("China", "India", "Brazil", "SouthAfrica")
P <- soch_profiles(g20_returns, c(adv, emg), tau = 0.05)
t1 <- soch_test_ordering(P, emerging = emg)
c(slope = round(t1$slope, 3), p_value = round(t1$p_value, 3))
#> slope p_value
#> 0.583 0.042
t1$means # mean peak scale by # emerging
#> 0 1 2
#> 2.666667 3.781250 3.833333
t3 <- soch_test_magnitude(P, advanced = adv, emerging = emg)
c(median_ratio = round(t3$median, 3), frac_gt1 = t3$frac_gt1,
p_value = round(t3$p_value, 3))
#> median_ratio frac_gt1 p_value
#> 1.1760 0.6875 0.1050prof_list <- lapply(names(P), function(k)
list(i = sub("\\|.*", "", k), j = sub(".*\\|", "", k), wqte = P[[k]]))
rates <- soch_fit_market(prof_list, c(adv, emg))
rates[order(-rates$alpha), ]
#> market alpha class
#> 7 Brazil 3.1415927 fast
#> 2 UK 2.4208596 fast
#> 1 USA 2.3590665 fast
#> 8 SouthAfrica 2.1623923 fast
#> 3 Germany 2.0796623 slow
#> 4 Japan 1.8343082 slow
#> 6 India 0.2909476 slow
#> 5 China 0.0763452 slow
plot_market_rates(rates)India and China are recovered as decisively the slowest adapters; the faster markets cluster near the Nyquist resolution limit and are not separately identified – exactly as the identification analysis predicts.
The shape-symmetry test uses a stationary block bootstrap and is heavier; run it directly:
res <- soch_test_symmetry(g20_returns, c(adv, emg), tau = 0.05, B = 200)
mean(res$holds) # share of unordered pairs that do not reject SOCH-B
plot_soch_symmetry(res)Or run the entire programme in one call: