Single trial metrics - LIMO-EEG-Toolbox/limo_tools GitHub Wiki
Basic trial metrics
[DT,TP,AC] = limo_trialmetric(data, 'sampling_frequency', 250)
with data, the EEG in 2D or 3D (channels * time * trials)
DT
is simply the standard deviation over time.
TP
is the total power - no need to known anything about sampling, use Parseval's thorem and integrate in the time domain.
AC
is the autocorrelation - knowing the sampling frequency helps by applying a median filter avoiding weird edge effects - indeed to know the smoothness in time it's faster to look, in the spectrum, at the distance between the maximum and it's closest peak (Wiener-Khinchin theorem).
Trial weights and outliers
[dist,out,rf,w1,w2] = limo_pcout(data)
with data the EEG in 2D (trials * frames)
dist
is a distance value for each trial. out
represents the outliers trials (containing boolean values of the same length as the number of trials for each electrode). This is what is use by limo_WLS.m to weight trials. The Principal Component Projection, performs a PCA over time retaining 99% of the variance, and rf
, tells you how many components were removed - because EEG is autocorrelated, removing 1% reduces a lot the dimensionality, making distances between trials more visible.
This distance is the combination of of w1
which measures where are trials relative to each other (the kurtosis weighted robust Euclidian distance) and of w2
which measures the scatter in the PCA space (the robust Euclidian distance). From dist, we can get out
, the binary vector where False values represent outlier trials.