Estimates the complexity of a time series using permutation entropy
(Bandt & Pompe 2002): the Shannon entropy of the distribution of
ordinal patterns ("motifs") of length order found in the series.
Ported from Lucas Franca's own mrpheus package (part of its AASM
sleep-staging feature pipeline), itself validated for exact parity
against the antropy Python library; re-validated here directly
against antropy 0.2.2 on synthetic test data (exact match to
displayed precision). See inst/COPYRIGHTS.
Arguments
- x
Numeric vector. The time series to analyse.
- order
Integer >= 2. Length of the ordinal pattern (embedding dimension). Default
3.- delay
Integer >= 1. Time delay between pattern elements. Default
1.- normalize
Logical. If
TRUE(default), divide bylog(order!)so the result falls in[0, 1]. IfFALSE, return the raw Shannon entropy in nats (natural log). Note this differs from theantropyPython library, which computes the raw value in bits (log base 2); the normalized value is base-independent and matchesantropyexactly, but the raw values are not directly comparable between the two. Seeinst/COPYRIGHTS.