Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install skidmarks

How to install skidmarks

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install skidmarks
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.0.3 Available View build log
Windows (64-bit)
0.0.3 Available View build log
Mac OS X (10.5+)
0.0.3 Available View build log
Linux (32-bit)
0.0.3 Available View build log
Linux (64-bit)
0.0.3 Available View build log
Lastest release
version 0.0.3 on Jan 5th, 2011

Skid Marks: Check for runs in sequences

Q: how do you check for runs?

A: look for skidmarks.

This module implements some functions to check a sequence for randomness. in some cases, it is assumed to be a binary sequence (not only 1's and 0's but containing only 2 distinct values). Any feedback, improvements, additions are welcomed.

>>> from skidmarks import gap_test, wald_wolfowitz, auto_correlation, serial_test




>>> r = wald_wolfowitz('1000001')
>>> r['n_runs'] # should be 3, because 1, 0, 1
>>> r['p'] < 0.05 # not < 0.05 evidence to reject Ho of random sequence

# this should show significance for non-randomness >>> li = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] >>> wald_wolfowitz(li)['p'] < 0.05 True


>>> result = auto_correlation('00000001111111111100000000')
>>> result['p'] < 0.05
>>> result['auto_correlation']

Serial Test


>>> serial_test('101010101111000')
{'chi': 1.4285714285714286, 'p': 0.69885130769248427}
>>> serial_test('110000000000000111111111111')
{'chi': 18.615384615384617, 'p': 0.00032831021826061683}

Gap Test


>>> gap_test('100020001200000')
{'chi': 756406.99909855379, 'item': '1', 'p': 0.0}
>>> gap_test('101010111101000')
{'chi': 11.684911193438811, 'item': '1', 'p': 0.23166089118674466}

gap_test() will default to looking for gaps between the first value in the sequence (in this case '1') and each later occurrence. use the item kwarg to specify another value.

>>> gap_test('101010111101000', item='0')
{'chi': 11.028667632612191, 'item': '0', 'p': 0.27374903509732523}

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.