Function Repository Resource:

# CUSUMMaxRandomnessTest

Conducts a cumulative sum–based randomness test that creates a test statistic from the maximum value that a cumulative sums random walk achieves

Contributed by: Emmy/Noah Blumenthal
noahb320@gmail.com
emmyb320@bu.edu
 ResourceFunction["CUSUMMaxRandomnessTest"][sequence] conducts a cumulative sum–based randomness test on sequence. ResourceFunction["CUSUMMaxRandomnessTest"][sequence,"properties"] conducts a cumulative sum–based randomness test on sequence and returns the associated property.

## Details and Options

CUSUMMaxRandomnessTest creates a test statistic from the maximum value that a cumulative sums random walk achieves, and returns the associated p-value.
Properties include:
 "TestStatistic" Returns the test statistic "PValue" Returns the p-value associated with the test
The test works only for sequences of zeros and ones.
Results are generally invalid for sequence lengths short than 100.
The test returns a two-tailed p-value of the distribution.

## Examples

### Basic Examples

Generate a sequence of random integers and apply a cumulative sums test:

 In[1]:=

Visualize the sequence:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Applications

Reject a non-random sequence:

 In[5]:=
 In[6]:=
 In[7]:=
 Out[7]=
 In[8]:=
 Out[8]=
 In[9]:=
 Out[9]=

Test the randomness of rule 30:

 In[10]:=
 In[11]:=
 Out[11]=
 In[12]:=
 Out[12]=

### Possible Issues

CUSUMMaxRandomnessTest requires sequences of length 100 or more:

 In[13]:=

### Neat Examples

Visualize the sampling distribution of the test statistic:

 In[14]:=
 In[15]:=
 Out[15]=