| Title: | Statistical Tools to Identify Dragon Kings |
|---|---|
| Description: | Statistical tests and test statistics to identify events in a dataset that are dragon kings (DKs). The statistical methods in this package were reviewed in Wheatley & Sornette (2015) <doi:10.2139/ssrn.2645709>. |
| Authors: | Raoul Wadhwa [aut, cre], Christian Kelley [aut], Daniel Qin [aut], Osaulenko Viacheslav [aut], Judit Szente [aut], Peter Erdi [aut] |
| Maintainer: | Raoul Wadhwa <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-06-03 10:36:25 UTC |
| Source: | https://github.com/rrrlw/dragonking |
dixon_stat calculates the DIxon test statistic to determine whether
there is significant support for the existence of r DKs in
vals. This test is less susceptible to swamping and masking, but is
also less powerful than the SS and SRS test statistics.
dixon_stat(vals, r)dixon_stat(vals, r)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
Dixon test statistic
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
Dixon WJ (1950). Analysis of extreme values. Ann Math Stat, 21(4): 488-506. <doi:10.1214/aoms/1177729747>
Likes J (1967). Distribution of Dixon's statistics in the case of an exponential population. Metrika, 11(1): 46-54. <doi:10.1007/bf02613574>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs dixon_stat(temp, r = 3)# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs dixon_stat(temp, r = 3)
dk_test runs the DK test on the user parameters and returns a
test statistic and corresponding p-value to aid in determining whether
there is significant support for the existence of r DKs in
vals.
dk_test(vals, r)dk_test(vals, r)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
DK test statistic and p-value (F distribution)
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
Pisarenko VF, Sornette D (2012). Robust statistical tests of dragon-kings beyond power law distributions. Eur Phys J Special Topics, 205: 95-115. <doi:10.1140/epjst/e2012-01564-8>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # test for DKs, where r is number of DKs thought to be in temp results <- dk_test(temp, r = 3) # print out test statistic (should be large) and p-value (should be small) print(paste("Test statistic =", results["Test Statistic"])) print(paste("p-value =", results["p-value"]))# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # test for DKs, where r is number of DKs thought to be in temp results <- dk_test(temp, r = 3) # print out test statistic (should be large) and p-value (should be small) print(paste("Test statistic =", results["Test Statistic"])) print(paste("p-value =", results["p-value"]))
This package provide statistical methods to identify events in a dataset that are dragon kings (DKs). The statistical methods in this package were reviewed in: Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28.
mrs_stat calculates the MRS test statistic to determine whether
there is significant support for the existence of r DKs in
vals. This test avoids denominator masking.
mrs_stat(vals, r, m)mrs_stat(vals, r, m)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
m |
pre-specified maximum number of DKs in |
MRS test statistic
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs mrs_stat(temp, r = 2, m = 3)# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs mrs_stat(temp, r = 2, m = 3)
ms_stat calculates the MS test statistic to determine whether
there is significant support for the existence of r DKs in
vals. This statistic is less susceptible to swamping, but is also
less powerful in the case of clustered outliers, in comparison to the SS
and SRS test statistics.
ms_stat(vals, r)ms_stat(vals, r)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
MS test statistic
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
Hawkins DM (1980). Identification of outliers, vol. 11. Chapman and Hall. ISBN: 9789401539944
Kimber AC (1982). Tests for many outliers in an exponential sample. Appl Statist, 31(3): 263-71. <doi:10.2307/2348000>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs ms_stat(temp, r = 3)# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs ms_stat(temp, r = 3)
srs_stat calculates the SRS test statistic to determine whether
there is significant support for the existence of r DKs in
vals. This test provides robustness to denominator masking.
srs_stat(vals, r, m)srs_stat(vals, r, m)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
m |
pre-specified maximum number of DKs in |
SRS test statistic
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
Iglewicz B, Martinez J (1982). Outlier detection using robust measures of scale. J Stat Comput Simul, 15(4): 285-93. <doi:10.1080/00949658208810595>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs srs_stat(temp, r = 2, m = 3)# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs srs_stat(temp, r = 2, m = 3)
ss_stat calculates the SS test statistic to determine whether
there is significant support for the existence of r DKs in
vals. This test is susceptible to swamping.
ss_stat(vals, r)ss_stat(vals, r)
vals |
numeric vector with at least 3 elements |
r |
integer indicating number of DKs in |
SS test statistic
Wheatley S, Sornette D (2015). Multiple outlier detection in samples with exponential & pareto tails: Redeeming the inward approach & detecting dragon kings. Swiss Finance Institute Research Paper Series No. 15-28. <doi:10.2139/ssrn.2645709>
Balakrishnan K (1996). Exponential distribution: Theory, methods and applications. CRC Press. pp. 228-30. ISBN: 9782884491921
Chikkagoudar MS, Kunchur SH (1983). Distributions of test statistics for multiple outliers in exponential samples. Commun Stat Theory Methods, 12: 2127-42. <doi:10.1080/03610928308828596>
Lewis T, Fieller NRJ (1979). A recursive algorithm for null distributions for outliers: I gamma samples. Technometrics, 21(3): 371-6. <doi:10.2307/1267762>
# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs ss_stat(temp, r = 3)# generate a numeric vector with DKs temp <- c(rexp(100), # exponentially distributed RV 15, 15, 15) # DK elements # calculate test statistic for DKs ss_stat(temp, r = 3)