# [Eeglablist] Filter causality pop_eegfiltnew

Tim Mullen mullen.tim at gmail.com
Mon Jan 27 17:03:50 PST 2014

Hi Vito,

Let me know how your performance comparisons go.

By the way, if you wish to perform temporal GC using SIFT, you can obtain
skip the "connectivity estimation" step and just return the VAR
coefficients from MODEL.AR. For each time window (each cell) this is a
[num_chans x num_chans * model_order] matrix containing the horizontally
concatenated VAR coefficient matrices for each lag: [A1 ... Ap], where p is
the model order. The prediction errors (residual covariance matrices) for
lags 0 to p are stored in MODEL.PE in similar form: [E0 E1 E2 ... Ep].
Following Definition 1 in the SIFT handbook, one can straightforwardly
obtain an asymptotic temporal GC estimate by deriving a Wald statistic from
these quantities and performing an F-test (see chapter 3.6.1 of Lütkepohl's
book New Introduction to Multiple Time Series Analysis). If I have the
time, I'll probably add this to SIFT at some point...

Tim

On Mon, Jan 27, 2014 at 1:10 PM, Vito de Feo <vito.defeo at zmnh.uni-hamburg.de
> wrote:

>  Hi Tim,
>
> thank you for your answer. I'm trying to evaluate the delay that I have
> with the Spectral GC in front of just temporal GC.
>
> Today I friend of mine told me that he has the same problem with the
> Chronux toolbox... now I understand that it was the same problem!
>
> Thanks a lot for changing the function! Next time I'll do by myself in
> order to contribute to improve the code.
>
> Vito
>
> P.S. I am going to answer also to the other interesting mail you wrote me.
>
> Quoting Tim Mullen <mullen.tim at gmail.com>:
>
>   Hi Vito,
>
>>  1) About the Spectral Granger Analysis it is true that "I can obtain a
>> temporal measure of Granger causality by integrating the GGC
>> (Granger-Geweke Causality) measure provided by SIFT across all
>> frequencies." but this requires much more time if I have to create a lot of
>> models for each trace. For example if I need to create 20000 models for one
>> traces and I am just interested to the integral I spend a lot of time
>> calculating the complete spectrum.
>>
>>
>  Both temporal and spectral GC require the same number of VAR models --
> one model per time window. Spectral GC includes an additional step where
> the transfer function is obtained via a Fourier transform of the model
> coefficients. But this step takes very little time on modern multicore
> computers (milliseconds). The remaining time would be involved in computing
> the residual covariance matrix and other quantities, which you need for
> temporal GC anyways. But, yes, if you have tens of thousands of time
> windows, there may be a slight overhead to the spectral approach (depends
> on the temporal GC implementation -- some of them actually perform F-tests
> for separately-fit full and restricted models, and are much slower than the
> spectral approach in SIFT)
>
>>
>> 3) I have a problem with the cleanline routine because you use a function
>> called "findpeaks" that I guess you wrote. The problem is that there is
>> already a matlab findpeaks function that also I use a lot. So I have
>> continuosly change path. Is possible to rename the findpeaks function in
>> the next cleanline release?
>>
>  Actually, the overloaded *findpeaks* is in the Chronux toolbox, part of
> which is included as an external dependency to cleanline. But, thanks for
> pointing that out -- I went ahead and changed the name of the function.
>  https://bitbucket.org/tmullen/cleanline/get/tip.zip
>  Or in the open-source tradition, free to just edit the code yourself and
> change that one function name and the 2 calls to it...
>
>
>  Tim
>
>
>>
>>
>> Quoting Tim Mullen <mullen.tim at gmail.com>:
>>
>>
>>
>>>  About SIFT, comparing it with Anil Seth's Granger toolbox it seems
>>> that in SIFT are missing a few things (probably I don't know very good
>>> SIFT):
>>>
>>>  1) In SIFT there is only the Spectral Granger Analysis, there is not
>>> the temporal Granger Analysis. Is this correct?
>>>
>>
>>
>>  You can obtain a temporal measure of Granger causality by integrating
>> the GGC (Granger-Geweke Causality) measure provided by SIFT across all
>> frequencies.
>>
>>
>>
>>>  2) In SIFT there is not a stationarity test. Is this correct?
>>>
>>
>>
>>  No there is not a direct test for stationarity (e.g. Augmented
>> Dickey-Fuller). Instead, stability and whiteness tests are provided. A
>> stable VAR model is always stationary so if the model passes stability and
>> whiteness tests (e.g. the data can be appropriately modeled as a stable VAR
>> process), stationarity of the data is implied. However, in cases where the
>> model residuals are not white or the model is not stable, it can be useful
>> to run a stationarity test on the data to determine if this is the problem.
>> For this, one might consider using the ADF procedure in the GCCA toolbox.
>> Bear in mind there are a few issues with this: The ADF test is a univariate
>> -- not multivariate -- stationarity test. We assume the system is a
>> multivariate autoregressive process (as does GCCA, for that matter) and are
>> interested in testing for non-stationarity in the multivariate dataset
>> (e.g. covariance stationarity) rather than testing each univariate
>> time-series independently. ADF also has low power, and in many cases fails
>> to reject the unit root hypothesis (e.g. Perron, 1989, Econometrica). There
>> are alternate proposed multivariate stationarity test procedures (e.g.
>> Jentsch and Rao, 2013; Yang and Shahabi, 2005), but these are not
>> implemented in SIFT. In many cases, the stability and whiteness tests
>> should suffice.
>>
>>
>>
>>>  3) In SIFT there is a common test for stability and consistence. Is
>>> this correct?
>>>
>>>
>>
>>  No, there are separate tests for stability and consistency.
>>
>>  Best,
>>  Tim
>>
>>
>>>
>>>
>>>  Il giorno 18/gen/2014, alle ore 19:50, Andreas Widmann ha scritto:
>>>
>>>  Dear all,
>>>
>>>  not directly related to your question and SIFT, but eegfilt is
>>> deprecated and I would recommend not using it any longer.
>>>
>>>  Best,
>>>  Andreas
>>>
>>> Am 18.01.2014 um 15:47 schrieb "jfochoaster ." <jfochoaster at gmail.com>:
>>>
>>>
>>>    Hello all,
>>>
>>> I'm following the SIFT tutorial, the section 6.5.1.3 is about filtering,
>>>
>>> Is better forget this section of filtering and use the recommendations
>>> in the past emails?
>>>
>>>  Are these recommendation critical for the analysis?, I mean, there is a
>>> lot of work about MVAR models in ECoG data
>>>
>>> Best wishes
>>>
>>> John
>>>
>>>
>>> On Fri, Jan 17, 2014 at 11:05 PM, mullen.tim at gmail.com <
>>> mullen.tim at gmail.com> wrote:
>>>
>>>> Oh thats interesting. I had not seen Anil's multitaper filter (might be
>>>> fairly recent). But possibly it is exactly the same approach that is in
>>>> Cleanline. If this is the method advocated by Mitra and Pesaran as in the
>>>> Chronux toolbox then indeed its the same. And highly recommended.
>>>>  -----Original Message-----
>>>> Date: Friday, January 17, 2014 1:21:30 pm
>>>> To: mullen.tim at gmail.com
>>>> Cc: trotta_gabriele at yahoo.com, drcoben at gmail.com, mmiyakoshi at ucsd.edu,
>>>> widmann at uni-leipzig.de, eeglablist at sccn.ucsd.edu
>>>> From: "Vito De Feo" <vito.defeo at zmnh.uni-hamburg.de>
>>>> Subject: Re: [Eeglablist] Filter causality pop_eegfiltnew
>>>>
>>>> Before using the Cleanline (that I used today for the first time) I
>>>> did't use the notch filter, I used a multi taper filtering made by Anil
>>>> Seth. I know that filtering is very bad for later VAR modeling, especially
>>>> notch and high pass. Low pass is better (usually I use multi taper
>>>> filtering to remove the noise lines and a low pass causal filter with cut
>>>> off filtering of 100 Hz).
>>>> Do you think is ok Tim?
>>>> Best
>>>> Vito
>>>>
>>>>
>>>> Il giorno 17/gen/2014, alle ore 20:53, mullen.tim at gmail.com ha scritto:
>>>>
>>>> > Do not notch filter your data! This can be very bad for later VAR
>>>> modeling -- and IMO bad in general. You can use an adaptive spectral
>>>> regression method such as that in the Cleanline plugin for eeglab to remove
>>>> line noise.
>>>> >
>>>> > See Barnett and Seth 2011 and Mitra and Pesaran 1999 for theoretical
>>>> discussions.
>>>> >
>>>> > Rob, there is no video of the SIFT workshop but the lecture pdfs are
>>>> online at the eeglab workshop page.
>>>> >
>>>> > Tim
>>>> > -----Original Message-----
>>>> > Date: Friday, January 17, 2014 10:18:32 am
>>>> > To: "
>>>>
>>>>  _______________________________________________
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> John Ochoa
>>> Docente de Bioingeniería
>>>
>>>
>>
>>
>> --
>> ---------  αντίληψη -----------
>>
>>
>>
>>
>>
>>  --
>> Pflichtangaben gemäß Gesetz über elektronische Handelsregister und
>> Genossenschaftsregister sowie das Unternehmensregister (EHUG):
>>
>> Universitätsklinikum Hamburg-Eppendorf
>> Körperschaft des öffentlichen Rechts
>> Gerichtsstand: Hamburg
>>
>> Vorstandsmitglieder:
>> Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden)
>> Prof. Dr. Dr. Uwe Koch-Gromus
>> Joachim Prölß
>> Rainer Schoppik
>>
>
>
>
> --
> ---------  αντίληψη -----------
>
>
>
>
>
> --
> Pflichtangaben gemäß Gesetz über elektronische Handelsregister und
> Genossenschaftsregister sowie das Unternehmensregister (EHUG):
>
> Universitätsklinikum Hamburg-Eppendorf
> Körperschaft des öffentlichen Rechts
> Gerichtsstand: Hamburg
>
> Vorstandsmitglieder:
> Prof. Dr. Christian Gerloff (Vertreter des Vorsitzenden)
> Prof. Dr. Dr. Uwe Koch-Gromus
> Joachim Prölß
> Rainer Schoppik
>

--
---------  αντίληψη -----------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20140127/f1cf196a/attachment-0001.html