Skip to main content
. 2018 Sep 14;20(9):709. doi: 10.3390/e20090709
Algorithm 2 Detecting multiple change-points
Input: sequence π=π(k)k=dL of ordinal patterns of order d, nominal probability α of false alarm.
Output: estimates of the number N^st of stationary segments and of their boundaries t^k*k=0N^st.
  • 1:

    functionDetectAllCP(π, α)

  • 2:

        N^st1; t^0*0; t^1*L; k0                      ▷ Step 1

  • 3:

        repeat

  • 4:

            t^* ← DetectSingleCP(π(l)l=t^k*+dt^k+1*), 2α;

  • 5:

            if t^*>0 then

  • 6:

               Insert t^* to the list of change-points after t^k* and renumber change-points t^k+1*,,t^N^st*;

  • 7:

               N^stN^st+1;

  • 8:

            else

  • 9:

               kk+1;

  • 10:

            end if

  • 11:

        until k<N^st;

  • 12:

        k ← 0;                                   ▷ Step 2

  • 13:

        repeat

  • 14:

            t^* ← DetectSingleCP(π(l)l=t^k*+dt^k+2*, α);

  • 15:

            if t^*>0 then

  • 16:

               t^k+1*t^*;

  • 17:

               kk+1;

  • 18:

            else

  • 19:

               Delete t^k+1* from the change-points list and renumber change-points t^k+2*,,t^N^st*;

  • 20:

               N^stN^st1;

  • 21:

            end if

  • 22:

        until k<N^st1;

  • 23:

        return N^st,t^k*k=0N^st;

  • 24:

    end function