Skip to main content
. 2020 Feb 19;22(2):236. doi: 10.3390/e22020236
Algorithm A1 Estimation of 1D entropy
  • 1:

    functionH1D({ui}, N, level)

  • 2:

    if level=0 then

  • 3:

                                   ▹Mn Spacing method

  • 4:

      Mn round(N1/3)

  • 5:

      ΔiuMn+iui, i=1,,NMn

  • 6:

      Hi=1MnlnΔi+(NMn)ln(N/Mn)/N

  • 7:

    else                           ▹ Uniform bins in [0,1]

  • 8:

      Nbinsmin{max#bins,N0.4,N/10}

  • 9:

      edges[0,1/Nbins,2/Nbins,,1]

  • 10:

                               ▹ Histogram with bins edges

  • 11:

      counts Histogram ({ui},edges)

  • 12:

      pcounts·Nbins/(counts)                 ▹ Normalize

  • 13:

      Hpln(p)/Nbins                ▹ where 0ln0=0

  • 14:

    end if

  • 15:

    return H

  • 16:

    end function