mtspec | R Documentation |
Compute the multitaper spectrum of a vector or matrix.
mtspec(
x,
fs = 1,
detrend = c("short-linear", "short-mean", "long-linear", "long-mean", "none"),
w = 4,
overlap = 0,
tbw = 2,
k = round(tbw * w - 1)
)
mtchan(chan, fs, detrend, n, overlap, tapers)
mtfft(dat, fs, tapers)
x |
input time series, specified as a numeric or complex vector. In case
of a vector it represents a single signal; in case of a matrix each column
is a signal. Alternatively, an object of class |
fs |
sampling frequency of |
detrend |
character string specifying detrending option; one of:
|
w |
length of sliding window (segments) in seconds. Default: 4 |
overlap |
proportion of overlap between the segments. Default: 0 |
tbw |
taper bandwidth, specified as a positive numeric value. Default: 2 Hz |
k |
number of tapers to use, specified as a positive numeric value.
Default: |
chan |
single channel |
n |
segment length (nearest power of 2 for |
tapers |
tapers from dpss |
dat |
data |
The multitaper method is a method for spectral density estimation, which overcomes some of the limitations of conventional Fourier analysis. It is a periodogram-based method that uses multiple tapers, or windows, to form independent estimates of the spectral density to reduce variance of the spectral density estimate. The method uses Slepian or discrete prolate spheroidal sequences as tapers since these vectors are mutually orthogonal and possess desirable spectral concentration properties. They average out noise in the spectrum and reduce information loss at the edges of the window.
The package multitaper
contains a more complete version of multitaper
spectral analysis (function spec.mtm
), which
computes confidence intervals, F-tests , and more.
The present implementation uses sliding windows, i.e., overlapping segments,
tapering each segment, and then averaging over tapered segments. The tapers
are computed by the function dpss
, with parameters
n = w * fs
(number of samples in sliding window), k = tbw * w -
1
(number of tapers), and nw = tbw * w / 2
(time bandwidth of the
tapers).
The function mtspec
computes the multitaper spectrum for a vector or
matrix. It calls the function mtchan
, which computes the multitaper
spectrum for a single channel (no parameter checking).
An object of class frd
, containing the spectra
Geert van Boxtel, G.J.M.vanBoxtel@gmail.com, based on Matlab code by Tim Mullen's (2011) adaptation of the Chronux 2 toolbox (http://chronux.org/) for the cleanline plugin in EEGlab.
https://en.wikipedia.org/wiki/Multitaper
spec.mtm, dpss,
frd
data(EEGdata)
sp <- mtspec(EEGdata[, 1:28], fs = fs(EEGdata), detrend = "short-linear")
plot(sp, yscale = "dB", main = "EEGdata")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.