Canonical ensemble for time series
The canonical ensemble here defined provides a way to create an unbiased randomization of a set of N time series each of length P (stored in a NxP matrix W) without missing data (but a similarly ensemble can be defined to include also missing data). The ensemble here defined is aimed at preserving, as averages, the following quantities :
- Total number of positive and negative events of each sampling time and each time series (number of entries greater/less than 0 of each row and column of W)
- Sum of positive and negative values recorded during each sampling and each time series (sum over positive/negative entries of each row and each column of W)
For further details see the article: https://arxiv.org/pdf/1907.04925.pdf
To use the package, given a matrix W in memory, just call [ lm ] = find_lm(W,1) to find the Lagrange Multipliers defining the ensemble. To sample n matrices from the ensemble, once the Lagrange Multipliers are known, use [ S ] = sample_ensamble( W,lm,n ) . Each instance of the ensemble can be seen as a alternative scenario coherent with the constraints imposed on the system.
Cite As
Riccardo Marcaccioli (2025). Canonical ensemble for time series (https://www.mathworks.com/matlabcentral/fileexchange/72000-canonical-ensemble-for-time-series), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.