Git Product home page Git Product logo

msmvsampen's Introduction

MSMVSampEn

R package implementing the multiscale multivariate sample entropy measure described by Ahmed and Mandic (2011). The implementation is more or less a direct translation of the author's Matlab code, though some changes have been made for speed and efficiency:

  • The embedding function has been rewritten in C++, for a substantial speedup.
  • The authors estimate Bm(r) by computing the full distance matrix for the embedded delay vectors, which can easily exhaust system RAM for even moderately sized datasets. Instead, I simply tally the number of vectors lying within the distance threshold r, sidestepping the distance matrix calculation entirely.

The package additionally implements the distribution entropy (DistEn) measure described by Karmakar, Udhayakumar, and Palaniswami (2015), which I call differential entropy or "DiffEn" because I made a typo and have no motivation to change it. Unlike SampEn, this requires the full distance matrix to be stored in memory at once. To avoid this, I randomly sample elements of the distance matrix 1000 at a time, and compute the average of the resulting entropy estimates.

Installation

The package can easily be installed with the devtools package using

devtools::install_github('areshenk/MSMVSampEn')

Entropy is then computed using the MSMVSampEn() function. For example, to compute the entropy of a 3-variate time series containing white noise, we create a 3xN matrix

data <- matrix(rnorm(3000), nrow = 3)

and then do

MSMVSampEn(mat = data, M, tau, r, eps, scaleMat = T)

where M is the embedding dimension, tau is the time lag parameter, r is the similarity threshold, eps is the time scale, and scaleMat = T specifies that the data are scaled.

Features

MSMVSampEn is capable of computing sample entropy for univariate or multivariate signals at arbitrary time scales. Currently, it only implements the coarsegraining procedure described by Ahmed and Mandic, although, as Humeau-Heurtier (2015) points out, this method has serious shortcomings. In the future, I hope to implement more sophistic methods of extracting informations at larger timescales.

The package allows for the specification of an arbitrary summary statistic to be used during coarsegraining by passing a function argument to MSMVSampEn(). This function is applied to each bin during coarsegraining. When this function in the mean (default), this gives the usual sample entropy, though, as Humeau-Heurtier mentions, other statistics (such as higher moments), are occasionally interesting.

References

Ahmed, M. U., & Mandic, D. P. (2011). Multivariate multiscale entropy: A tool for complexity analysis of multichannel data. Physical Review E, 84(6), 061918.

Humeau-Heurtier, A. (2015). The multiscale entropy algorithm and its variants: A review. Entropy, 17(5), 3110-3123.

msmvsampen's People

Contributors

areshenk avatar

Watchers

James Cloos avatar wall-e avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.