Package jline.api.sim

Class Sim_vonneumann

java.lang.Object
jline.api.sim.Sim_vonneumann

public final class Sim_vonneumann extends Object
Von Neumann ratio test for randomness of a sequence.

The statistic is the ratio of the mean square successive difference to the variance,

   ratio = sum_{i=1}^{b-1} (x_{i+1}-x_i)^2 / sum_{i=1}^{b} (x_i - xbar)^2.
 

Under the null hypothesis that the sequence is i.i.d. normal the ratio has mean 2 and variance 4(b-2)/((b-1)(b+1)), and the standardized statistic is asymptotically normal, giving a two-sided p-value. Serial correlation of either sign moves the ratio away from 2: positive correlation shrinks the successive differences and pushes the ratio below 2, negative correlation pushes it above. Those null moments were confirmed by Monte Carlo over b = 10, 16, 24, 32, 50 to within 0.3%.

Port of MATLAB sim_vonneumann.m.

Reference: J. von Neumann, "Distribution of the Ratio of the Mean Square Successive Difference to the Variance", Ann. Math. Statist. 12(4), 1941; L. C. Young, "Randomness in Ordered Sequences", Ann. Math. Statist. 12, 1941.

Since:
LINE 3.1.0
  • Method Details

    • sim_vonneumann

      public static HypothesisTestResult sim_vonneumann(double[] x)
      Tests a sequence for randomness at the 5% level.
      Parameters:
      x - the sequence, at least 3 finite and not all equal values
      Returns:
      the test outcome
    • sim_vonneumann

      public static HypothesisTestResult sim_vonneumann(double[] x, double alpha)
      Tests a sequence for randomness.
      Parameters:
      x - the sequence, at least 3 finite and not all equal values
      alpha - significance level in (0,1)
      Returns:
      the test outcome