Skip to main content
. 2020 Mar 25;22(4):374. doi: 10.3390/e22040374
Algorithm 1 MCPD with a variable window
Require:X,Winit,Wgrow,Wmax,Wmargin,α
  • 1:

    Calculate Oπ,Cumt from Equation (7), (24), and (25)

  • 2:

    CP=

  • 3:

    t1=0,t2=Winit

  • 4:

    whilet2 length(X) do

  • 5:

        for j=t1+Wmargin:t2Wmargin do

  • 6:

            Calculate LH0 and LH1 from Equation (19)

  • 7:

            Calculate LR(j) from Equation (20)

  • 8:

        end for

  • 9:

        jcandidate=argmax(LR)

  • 10:

        LRmax=LR(jcandidate)

  • 11:

        if LRmax<ICDFχ2(m!1)(1α) then

  • 12:

            if t2t1<Wmax then

  • 13:

               t2=t2+Wgrow

  • 14:

            else

  • 15:

               t1=t2

  • 16:

               t2=t2+Winit

  • 17:

            end if

  • 18:

        else

  • 19:

            CP=CPjcandidate

  • 20:

            t1=jcandidate+1

  • 21:

            t2=t1+Winit

  • 22:

        end if

  • 23:

    end while