Package 'dragonking'

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: 2025-02-07 04:56:42 UTC
Source: https://github.com/rrrlw/dragonking

Help Index


Dixon test statistic to identify dragon kings (DKs)

Description

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.

Usage

dixon_stat(vals, r)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

Value

Dixon test statistic

References

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>

Examples

# 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)

Statistical test to identify dragon kings (DKs)

Description

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.

Usage

dk_test(vals, r)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

Value

DK test statistic and p-value (F distribution)

References

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>

Examples

# 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"]))

dragonking: Statistical tools for identifying dragon kings

Description

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.


Max-robust-sum (MRS) test statistic to identify dragon kings (DKs)

Description

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.

Usage

mrs_stat(vals, r, m)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

m

pre-specified maximum number of DKs in vals

Value

MRS test statistic

References

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>

Examples

# 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)

Max-sum (MS) test statistic to identify dragon kings (DKs)

Description

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.

Usage

ms_stat(vals, r)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

Value

MS test statistic

References

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>

Examples

# 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)

Sum-robust-sum (SRS) test statistic to identify dragon kings (DKs)

Description

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.

Usage

srs_stat(vals, r, m)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

m

pre-specified maximum number of DKs in vals

Value

SRS test statistic

References

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>

Examples

# 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)

Sum-sum (SS) test statistic to identify dragon kings (DKs)

Description

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.

Usage

ss_stat(vals, r)

Arguments

vals

numeric vector with at least 3 elements

r

integer indicating number of DKs in vals

Value

SS test statistic

References

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>

Examples

# 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)