User Reference:SpectralEstimator

From BCI2000 Wiki
Jump to navigation Jump to search

Function

The ARFilter computes an autoregressive model of its input data using the Maximum Entropy Method (Burg algorithm). Spectral estimation is done separately for each of the filter's input channels. Its output may be raw AR coefficients, or an estimated power spectrum collected into bins. Thus, it can be used in place of the FFTFilter.

Obtaining a discrete spectrum from an AR model

AR coefficients are actually the coefficients of an all-pole linear filter that is fitted to reproduce the data's spectrum when applied to white noise.

Thus, the estimated power spectrum directly corresponds to that filter's transfer function, divided by the signal's total power. To obtain spectral power for finite-sized frequency bins, that power spectrum needs to be multiplied by total signal power, and integrated over the frequency ranges corresponding to individual bins.

This is done by numerical integration, evaluating the spectrum at equally spaced evaluation points, summing, and multiplying by bin width to obtain the power corresponding to a certain bin. For amplitude rather than power spectrum output, bin integrals are replaced with their square roots.

Physical unit of the estimated spectrum

A power spectrum is an energy density distribution over frequencies. Thus, its physical dimension is "energy per frequency". The ARFilter actually computes a time series of such spectra, representing a flow of energy in each single point in the frequency domain. The proper physical dimension of such a flow is "energy per frequency per time".

In BCI2000, signal amplitude is measured in , so signal energy is measured in . Measuring frequency in Hz, and time in seconds, these will cancel out in the physical unit's denominator. Thus, the physical unit of a power spectrum is , and for an amplitude spectrum.

Parameters

For all frequency-valued parameters, raw float values are interpreted in terms of the sampling rate; absolute frequencies may be given when followed with Hz, as in the following examples:

  • 0.5 will always refer to the Nyquist frequency (half the sampling rate).
  • 10.3Hz specifies a value of 10.3 Hz, regardless of the sampling rate.
  • 15/2Hz specifies a value of 7.5 Hz.
  • The unit must immediately follow the number.

WindowLength

The length of the input data window over which the model/spectrum is computed, given as a time value in seconds (then immediately followed by the unit), or the number of signal blocks as in the following examples:

1.34s
500ms
5

Detrend

Determines whether data are detrended prior to spectral estimation. Possible values are

  • 0: no detrending,
  • 1: mean removal,
  • 2: linear trend removal.

ModelOrder

The order of the autoregressive model. Roughly, this corresponds to the maximum number of peaks in the resulting spectrum.

OutputType

Possible values are

  • 0: spectral amplitude,
  • 1: spectral power,
  • 2: AR coefficients.

If the output is a spectrum, the output signal's elements correspond to uniformly spaced frequency bins. For raw AR coefficients, the first output signal element contains total signal power, followed by the model's denominator coefficients.

FirstBinCenter

A float value representing the center of the first frequency bin, e.g. "5Hz".

LastBinCenter

A float value representing the center of the last frequency bin.

BinWidth

A single nonnegative float value representing the width of a single bin, e.g. "3Hz".

EvaluationsPerBin

A single nonnegative integer value representing the number of uniformly spaced evaluation points that enter into a single bin's value.

States

None.

Examples

For a typical EEG application, you might use the following configuration:

ModelOrder= 16
FirstBinCenter= 0Hz
LastBinCenter= 30Hz
BinWidth= 3Hz
EvaluationsPerBin= 15

This will result in 11 bins, with the first bin covering the DC range from -1.5 to 1.5 Hz, which, due to symmetry of the transfer function, is twice the integral from 0 to 1.5 Hz. The last bin will cover the range from 28.5 Hz to 31.5 Hz. Evaluation points will be 0.2 Hz apart.

See also

FFTFilter, User Reference:Matlab MEX Files#mem