The following R, S-plus, matlab and java programs compute the distribution
and the first moment of the length of the longest k-interrupted run (Lk) in a
binary sequence.
Reports the tail probability of
LSR{k} (longest k-interrupted run) for k=0-3 of a binary sequence obtained from a p-value sequence
under independent assumption.
Transferred p-value sequence pv is into a
binary sequence by the inputted threshold,
and report its longest k-interrupt run
Lk, k=0-3 as well as the corresponding
tail probability P(Lk >=w) are reported.
The out also includes goodness of fit
tests for markov independence and
1st order dependence
*
The file contains the following subroutine : (1)Lk.length : reports the max length of well-matching (1) run,
allowing #k mismatches within a binary sequence a. (2)
Lk.marko.test_function(sq): test if seq is Ho: independent seq vs H1: 1st
oreder Markov. (3) Lk.0, Lk.1, Lk.2, Lk.3: compute the probability P(Lk>=d)
for k=0~3. Note that computation
time for k=3 is exceptionally longer than smaller k.
waterman (ps,n, d, k): need to give ps (the initial
probability for 1)
Lk.waterman(a,k): compute the
tail probability
of Lk for a zero-one binary sequence a.