A state space modeling approach to real-time phase estimation

  1. Anirudh Wodeyar  Is a corresponding author
  2. Mark Schatza
  3. Alik S Widge
  4. Uri T Eden
  5. Mark A Kramer
  1. Mathematics and Statistics, Boston University, United States
  2. Department of Psychiatry, University of Minnesota, United States
  3. Center for Systems Neuroscience, Boston University, United States
19 figures, 1 table and 1 additional file

Figures

Illustration of state space phase estimate (SSPE) procedure.

Given an observation (A, red), we estimate model parameters in an initial interval of data. At subsequent times, we use the observed data to (B) predict and update the state estimate (purple), and (C

Wide band rhythm’s phase better tracked with state space phase estimate (SSPE).

(A) Example 2 s of simulated observed data (thick curves) and the true phase (thin blue curves) for each scenario. (B) For each scenario, example spectra of (B.i) the signal, and (B.ii) the …

SSPE performs well when two oscillations exist at nearby frequencies.

(A) Example observed signal (black) and phase for two simulated rhythms, the confounding rhythm at 5 Hz (blue) and the target rhythm at 6 Hz (red). (B) Example phase estimates for the target rhythm …

Figure 3—source data 1

Circular standard deviation for all methods on two simultaneous oscillations simulation.

https://cdn.elifesciences.org/articles/68803/elife-68803-fig3-data1-v2.mat
The state space phase estimate (SSPE) accurately tracks phase following a phase reset.

(A) Example phase of a 6 Hz sinusoid (blue) with four phase resets (red dashed lines). (B) Example phase estimates (thin curves) and the true phase (thick blue curve) at the indicated phase reset in …

Figure 5 with 1 supplement
State space phase estimate (SSPE) tracks an oscillatory signal with less error across a range of signal-to-noise ratios (SNR).

(A) Example 2 s of simulated observed data (thick curves) and true phase (thin blue curves) for each SNR value. (B) For each SNR, (i) the average credible interval width (colored circles) of the …

Figure 5—source data 1

Circular standard deviation for all methods on signal-to-noise ratio (SNR) simulation.

https://cdn.elifesciences.org/articles/68803/elife-68803-fig5-data1-v2.mat
Figure 5—figure supplement 1
Example power spectra for all simulated cases.

At each signal-to-noise ratio (SNR), for a smooth spectrum, we used 15 s of data and applied the multitaper method with 29 tapers and a bandwidth of 1 Hz. The SNR is controlled by shifting the power …

Figure 6 with 1 supplement
Any interval with a prominent rhythm of interest (here: theta) can be used to fit state space phase estimate (SSPE) parameters.

(A) The phase error for a single instance of the model fit (using data at times 10–20 s, blue curve), and the 90% interval for phase error (red bands) at time t derived using parameter estimates …

Figure 6—source data 1

Error and spectrogram for in vivo local field potential (LFP) data.

https://cdn.elifesciences.org/articles/68803/elife-68803-fig6-data1-v2.mat
Figure 6—figure supplement 1
The state space phase estimate (SSPE) method performs optimally across algorithms when tracking local field potential (LFP) theta.

The error (circular deviation) in performance of each algorithm across all LFP data. Each dot represents the error computed for 1 s of data. To compute the error, we compare the real-time phase …

Figure 7 with 1 supplement
State space phase estimate (SSPE) tracks in vivo credible intervals for the phase.

(A) Example rodent local field potential (LFP) data (red, solid) with a consistent broadband peak in the theta band (4–8 Hz). The estimated state of the SSPE method (purple, dashed) tracks the …

Figure 7—source data 1

Amplitude and credible interval widths for local field potential (LFP) data.

https://cdn.elifesciences.org/articles/68803/elife-68803-fig7-data1-v2.mat
Figure 7—figure supplement 1
All methods produce similar phase estimates during segments of the theta rhythm with high signal-to-noise ratio (SNR).

(A.i.) Example rodent local field potential (LFP) data. (A.ii) Phase estimates from each method (see legend) are consistent when the SNR of the theta rhythm is high.

Figure 8 with 3 supplements
State space phase estimate (SSPE) parameters can be estimated from any interval of electroencephalogram (EEG) mu rhythm and credible intervals for mu rhythm phase indicate periods of confidence.

(A) Phase error for a model fit using data from the first 10 s (blue curve), and the 95% confidence intervals (red) in the error for phase estimates at time t using models fit at times prior to time …

Figure 8—source data 1

Error and spectrogram for in vivo electroencephalogram (EEG) analysis.

https://cdn.elifesciences.org/articles/68803/elife-68803-fig8-data1-v2.mat
Figure 8—figure supplement 1
All methods produce similar phase estimates during segments of the mu rhythm with high signal-to-noise ratio (SNR).

(A.i) Example mu rhythm clearly visible in the early portion of the electroencephalogram (EEG) trace. (A.ii) Phase estimates from each method (see legend) are consistent when the SNR of the mu …

Figure 8—figure supplement 2
The state space phase estimate (SSPE) method performs optimally across algorithms when tracking the electroencephalogram (EEG) mu rhythm.

The error (circular deviation) in performance of each algorithm across all EEG data. Each dot represents the error computed for 1 s of data. To compute the error, we compare the real-time phase …

Figure 8—figure supplement 3
State space phase estimate (SSPE) captures non-sinusoidality of the mu rhythm.

(A.i) The observed data (orange) is well tracked by the (summed) state estimate (purple, dotted) of the 10 and 22 Hz oscillators. (A.ii) Phase estimates for the 10 Hz (blue, dotted) and 20 Hz …

Motor evoked potential (MEP) amplitude is predicted by the pre-stimulus state space phase estimate (SSPE) estimated mu rhythm phase.

(A) Log-transformed MEP amplitude versus phase with no threshold applied to the credible interval width. White dot indicates the median of the MEP amplitude. Yellow line is the best fit circular …

State space phase estimate (SSPE) implementation in Toolkit for Oscillatory Real-time Tracking and Estimation (TORTE) is accurate, with negligible latency.

(A) Open Ephys GUI for using SSPE. The user specifies the number of frequencies to track, the center frequencies to track, the frequencies of interest for phase calculation and output (FOI), …

Author response image 1
Author response image 2
Author response image 3
The SSPE method performs as well as the acausal FIR and Blackwood methods for 1/f amplitude modulated data.
Author response image 4
Author response image 5
Author response image 6
Example data trace for the proposed model.

The amplitude of the 6 Hz sinusoid waxes and wanes in time.

Author response image 7
The Blackwood method outperforms the other causal algorithms for the multiplicative 1/f sinusoid example, similar to “Sines in Pink Noise”.
Author response image 8
.

We find that SSPE still performs well for two oscillations at nearby frequencies, with random initial phases; compare to Figure 3 of the main manuscript.

Author response image 9
Credible intervals better capture the presence of theta cycles than an amplitude threshold.

(A,B) Two example traces showing intervals in which the rhythm amplitude is small (below the 65th percentile, white intervals, also indicated by purple trace equaling 0), yet the credible intervals …

Tables

Table 1
Error following phase reset for different phase estimation methods.
SSPEBlackwoodZrennerAcausal FIR
Error (std. dev.)2.85 (0.89)*62.08 (0.38)44.68 (0.38)15.04 (0.23)
Time to convergence(std. dev.)34 ms (162)190 ms (33)747 ms (22)555 ms (206)
  1. *

    p~0 compared to all other methods.

Table 1—source data 1

Circular standard deviation and convergence time information for phase reset simulation.

https://cdn.elifesciences.org/articles/68803/elife-68803-table1-data1-v2.zip

Additional files

Download links