[Eeglablist] linear causal filter
nasibeh talebi
nasibeh.talebi at gmail.com
Mon Mar 13 01:19:26 PDT 2023
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Dear Andreas,
Thank you very much for your detailed and complete answer.
My connectivity study involves a *non-linear multivariate autoregressive
model*:
For *M* time series (representing samples of cortical signals from M
regions of interest x(n)=[x_1 (n),x_2 (n),…,x_M (n)]^T):
x(n)=f(x_p)+σ(n)
where x_p=[x_1 (n-1),x_2 (n-1),⋯,x_M (n-1),x_1 (n-2),⋯,x_M (n-2),⋯,x_1
(n-p),⋯,x_M (n-p) ]^T is the vector of *p* past samples of the *M *time
series, and the nonlinear function f(.) quantitatively describes the
cortical interaction between the signals, and σ(n)=[σ_1,σ_2,…,σ_M ]^T is a
normally distributed real-valued zero-mean white noise.
Therefore, to investigate causality, it is necessary that the output at any
time (n) is only influenced by delayed samples of itself and other regions.
That's why I insisted on using a causal filter.
However, with your explanation, I think that if I ignore the delay
correction or I correct the delay for all channels with a constant value,
there will be no challenge for the assessment of the causal relationship
among them. Am I correct? Is the delay correction value the same for all
channels in "*eegfiltnew.m*" code? Do you suggest that I continue with "
*eegfiltnew.m*"?
With best regards,
Nasibeh
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On Fri, Mar 10, 2023 at 6:17 PM Andreas Widmann <widmann at uni-leipzig.de>
wrote:
> Hi Nasibeh,
>
> > I want to pre-process the single-trial EEG signals for a connectivity
> study
> > (So the causality between signals must be preserved).
> To help you with this question, could you please elaborate more on your
> considerations on connectivity and/or/vs. causality?
>
> > 1. My main question is what linear fitter can preserve causal
> > relationships? Which of the codes *eegfilt.m* or *eegfiltnew.m* should I
> > use?
> Linearity and causality are not directly (but only indirectly) related. A
> linear filter will (typically) introduce a large delay. It is not the
> linear filter per se but the correction of this delay which violates
> causality. In a linear filter the (group) delay is constant at the
> different frequencies (within the passband). Therefore the easiest way to
> correct for the delay is to simply shift the output signal backward in time
> (relative to external reference; event, trigger). The other common way is
> filtering backwards a second time (see the second paper below for
> discussion of drawbacks). In both cases, causality with respect to the
> external reference is violated. This is relevant for example when
> determining onset latencies.
>
> In a nutshell, if you filter a step signal, in a causal filter the filter
> output must never deviate from zero before the step appeared in the input.
> However, in the causal filter output the step is delayed substantially. If
> you correct for the delay by shifting or backward filtering the step
> latency is similar in input and output but the output signal may deviate
> from zero already before the step occurred in the input.
>
> Non-causal filters may considerably reduce the delay and therefore avoid
> problems with causality as it may not be necessary to correct.
>
> A linear filter will shift all frequencies (and all channels) by the same
> amount, thus, to my understanding it should not affect connectivity whether
> you correct for the delay of not (but you may have to account for the delay
> during interpretation in case not correcting). However, there are so many
> aspects in connectivity analysis that I might miss something. Therefore my
> question whether you could elaborate more on your considerations.
>
> > It is suggested
> > to use *eegfiltnew.m* code instead. As far as I know, in *eegfiltnew.m*,
> a
> > non-linear filter is used to minimize the phase.
> No, by default eegfiltnew.m implements a non-causal (i.e., delay
> corrected) linear FIR filter. Non-linear minimum phase is just an option
> (and implemented as a causal filter; i.e. not filtering backwards). Minimum
> phase means that the introduced delay is minimal (but different) at
> different frequencies (thus, typically unsuitable for connectivity
> analysis).
>
> > 2. If I manually specify the filter order in advance, can I use code
> > *eegfilt.m*?
> No, besides incorrect filter order the problem is partly also related to
> usage of MATLAB firls not computing but fitting filters. Fitting is
> inaccurate and can go wrong.
>
> > Why is it said to be broken?
> See here:
> Widmann, A., & Schröger, E. (2012). Filter effects and filter artifacts in
> the analysis of electrophysiological data. Frontiers in Psychology, 3, 233.
> doi: 10.3389/fpsyg.2012.00233
> https://urldefense.com/v3/__https://www.frontiersin.org/articles/10.3389/fpsyg.2012.00233/full__;!!Mih3wA!CaY-WXqDSHSDgMK9yvWXyi0ErQbJpoqn5r4dKc8JP9-sILog9-jDvF89AZb05kVAfBRqZO0qdZnomsOWtwA6EdaQJ1acsw$
> and here:
> Widmann, A., Schröger, E., & Maess, B. (2015). Digital filter design for
> electrophysiological data–a practical approach. J Neurosci Methods, 250,
> 34-46.
>
> https://urldefense.com/v3/__https://home.uni-leipzig.de/biocog/eprints/widmann_a2015jneuroscimeth250_34.pdf__;!!Mih3wA!CaY-WXqDSHSDgMK9yvWXyi0ErQbJpoqn5r4dKc8JP9-sILog9-jDvF89AZb05kVAfBRqZO0qdZnomsOWtwA6EdazcL4J9Q$
> <
> https://urldefense.com/v3/__http://home.uni-leipzig.de/biocog/eprints/widmann_a2015jneuroscimeth250_34.pdf__;!!Mih3wA!CaY-WXqDSHSDgMK9yvWXyi0ErQbJpoqn5r4dKc8JP9-sILog9-jDvF89AZb05kVAfBRqZO0qdZnomsOWtwA6EdbqSP8sZw$
> >
>
> > 3. Do you have any other suggestions other than code *eegfilt.m* or
> > *eegfiltnew.m*?
> A linear causal filter can be achieved on the command line interface. I
> can assist implementing this in case you really want to still use it after
> reading the above papers. But note that the output of a causal linear
> filter is *identical* to the output of an equivalent non-causal linear
> filter. In the former, the filter output signal is just delayed by the
> group delay (i.e., half the filter order for FIR; convert to time units by
> dividing by sampling rate) relative to the latter.
>
> Hope this helps! Best,
> Andreas
>
> > Furthermore, for my
> > study, the filter should only be linear (so the non-linear minimum phase
> > filter is not suitable for me).
> >
> > According to my studies, I think one recommendation is to use the linear
> > causal filter with *eegfilt.m* code. But on
> >
> https://urldefense.com/v3/__https://eeglab.org/others/Firfilt_FAQ.html*q-should-i-use-a-linear-causal-fir-filter-with-delay-correction-or-a-non-linear-causal-filter-eg-minimum-phase__;Iw!!Mih3wA!FTkqp_XEBN-Ou1XueybEqx94jz9_vW80orzKJHQJ5m8xg2JEsBetYZ9anlSqohf4ElnES8Sc9cX3Nl5l529RX6lwwyX34g$
> > it is suggested not to use this code because it is broken! It is
> suggested
> > to use *eegfiltnew.m* code instead. As far as I know, in *eegfiltnew.m*,
> a
> > non-linear filter is used to minimize the phase.
> >
> >
> >
> > 1. My main question is what linear fitter can preserve causal
> > relationships? Which of the codes *eegfilt.m* or *eegfiltnew.m* should I
> > use?
> >
> >
> >
> > 2. If I manually specify the filter order in advance, can I use code
> > *eegfilt.m*? Why is it said to be broken?
> >
> >
> >
> > 3. Do you have any other suggestions other than code *eegfilt.m* or
> > *eegfiltnew.m*?
> >
> >
> >
> >
> >
> > With regards
> >
> >
> >
> > Nasibeh
> > _______________________________________________
> > Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> > For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
>
More information about the eeglablist
mailing list