crit_val_op
Notedocblock
crit_val_op(chart_choice, m, n_patterns; alpha=0.05)Compute the asymptotic critical value of the ordinal-pattern test test_op.
The critical value depends only on the chart, on the pattern length m, on the number of patterns n_patterns and on the level alpha, but not on the data. In a Monte Carlo study it can therefore be computed once per sample size and reused in every replication, which is much faster than calling test_op in the loop: test_op additionally evaluates the p-value, and for Shannon(), ShannonExtropy() and DistanceToWhiteNoise() that means a numerical evaluation of a generalized chi-squared distribution per call.
chart_choice: one ofShannon(),ShannonExtropy(),DistanceToWhiteNoise(),UpDownBalance(),Persistence(),RotationalAsymmetry(),UpDownScaling(). ForShannonandShannonExtropy, the statistic is in the logarithm base of the chart, which must be larger than 1. Both default to base 2 in ComplexityMeasures.jl; useShannon(base=exp(1))for the natural logarithm used in the papers. Statistic and critical value are both in that base, so the test decision and the p-value do not depend on it.m::Int: length of the ordinal patterns. Asymptotic theory is available form = 3(andm = 2forShannon(),DistanceToWhiteNoise()andUpDownBalance()).n_patterns::Int: number of ordinal patterns,length(ts) - (m - 1) * d.alpha=0.05: significance level. The null hypothesis is rejected when the statistic falls below the critical value forShannon()andShannonExtropy(), exceeds it forDistanceToWhiteNoise(), and exceeds it in absolute value for the four statistics of Bandt (2019).
x = randn(500)
n = length(x) - 2
crit = crit_val_op(Persistence(), 3, n)
abs(chart_stat_op(stat_op(x; chart_choice=Persistence())[2], Persistence())) > crit