Scan_for_breaks
Scans a noisy timeseries for events where the mean value changes abruptly. An example is an ion channel in a metastable state where the conductance jumps between different values. This program searches for the event-points and returns their location and the mean value of the the data between events. The program runs without user supervision and the decision to accept or reject divisions is made according to Rissanen's Minimum Description Length Principle.
[breaks, idealized_x, steplength, stepvalue, jumps] = scan_for_breaks(x, optional lmin)
The input vector 'x' will be scanned for breakspoints using the Minimal Description Length Principle. The parameter 'lmin' is the smallest segment that will be detected by the algorithm and is by default 1. Increasing lmin to 3 or 5 may help if you have many false-positive detections. If called with no arguments, the function generates a 1e5 data point test data set with 20 random segments, searches and displays results.
Outputs:
breaks = indices of break points in x.
idealized_x = piecewise constant time series of same length as x
steplength = number of datapoints in each segment.
stepvalue = mean value of x in each segment
jumps = difference in mean value between neighboring segments
This program is developed for analysis of ion channel recordings, but can be applied for other types of non-stationary data. The important part is that the noise must be uncorrelated.
The algorithm is described in "Unsupervised idealization of ion channel recordings by Minimum Description Length: Application to human PIEZO1-channels" by Radhakrishnan Gnanasambandam, Morten Schak Nielsen, Christopher Nicolai, Frederick Sachs, Johannes Pauli Hofgaard, and Jakob Kisbye Dreyer. Frontiers Neuroinformatics, 11:31, 2017 (https://doi.org/10.3389/fninf.2017.00031)
Examples:
Run on test data:
>>Scan_for_breaks
Generate your own test data with 50 data points being offset from the other. Get location of breakpoints (br) and the idealized segment (x_hat) and plot the results:
>> x = [randn(1,400) randn(1,50)+1 randn(1,400)];
>> [br x_hat] = scan_for_breaks(x);
>> t = 1:length(x);
>> plot(t, x, t, x_hat)
Restrict the shortest segment to be 100 datapoints (with this restriction, the algorithm will often fail to detect the hidden segment of the example above):
>> scan_for_breaks(x, 100)
Cite As
Jakob Dreyer (2024). Scan_for_breaks (https://www.mathworks.com/matlabcentral/fileexchange/60224-scan_for_breaks), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Cluster Analysis and Anomaly Detection >
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.
Scan_for_breaks_MDL/
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |
Updated description text.
|