# [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes

Darren Price Darren.Price at mrc-cbu.cam.ac.uk
Thu Oct 13 14:15:53 CEST 2016

```Hi Son

For who have emailed asking for code, it is pasted below.

Son, I see what you mean. In that case creating surrogate data is still necessary, since you need a way to generate a confidence interval for each set of N channels. A rough outline of your pipeline would be: (this is all assuming your measure is not simply a function of the covariance matrix)

for si = each surrogate dataset (1:1000):
64chanresult = compute result for 64 chan configuration
for chani = each N of channels ranging from 64:32
Nchanresult = compute result for 64 chan configuration
change(si, chani) = 64chanresult - Nchanresult
end
end

then you can plot your data as a line graph with confidence intervals.

I dug out a script I used a while ago, although you might want to check that it works properly (comparing correlation matrices of input/output).  The main caveat is that you need to check that you take care of negative frequencies adequately. Here I have used a method of simply cancelling negative frequencies. The other way is to use the complex conjugate, but I found that less stable, perhaps due to numerical imprecision – I’m not sure. Anyway you should verify for yourself that the correlation matrix of your original data is almost exactly the same as your surrogate data (within reason: differences on the order of <1e-5, although this depends on the length of the data). You should detrend and filter before using this function.

function data = randomisePhase(data, equalphase)
% data = array: [time, channels]
% equalphase boolean: [true | false] (do you want the same phase shift in
% each channel? default = true)

if nargin == 1
equalphase = true;
end

L = size(data, 1);

data = fft(data)*2;
data(L/2+1:end, :) = 0;
randphase = exp(1i*randn(1,L)*2*pi)'; % uses the same phase for each channel

for ii = 1:size(data,2)
if equalphase == false
randphase = exp(1i*rand(L,1)*2*pi)’;
end
data(:,ii) = real(ifft(data(:,ii).*randphase));
end

Darren
-------------------------------------------------------
Dr. Darren Price
Investigator Scientist and Cam-CAN Data Manager
MRC Cognition & Brain Sciences Unit
15 Chaucer Road
Cambridge, CB2 7EF
England
EMAIL:  darren.price at mrc-cbu.cam.ac.uk
URL:    http://www.mrc-cbu.cam.ac.uk/people/darren.price
TEL     +44 (0)1223 355 294 x202
FAX     +44 (0)1223 359 062
MOB     +44 (0)7717822431
-------------------------------------------------------

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Ta Dinh, Son
Sent: 13 October 2016 10:25
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes

Hi Darren,

Thanks for the great answer! I’ll definitely check out the reference you provided. Creating a surrogate dataset sounds like a good way to test robustness of my original data. The code for Matlab would be much appreciated if it isn’t too much effort for you. I would also be interested in the pitfalls you mentioned, could you elaborate on those?

The thing is, what I was actually trying to do was not checking the robustness of the original data in general but rather to see how strongly the data (in particular this one specific graph measure) is affected by reducing the amount of electrodes. Context for this is that I wanted to check the viability of the measure in a clinical setting where it is unrealistic to have 64 electrodes available and the standard is usually 16 electrodes (or less). So what I would really like to know how strongly the graph measure is affected by reducing the amount of nodes in the graph, and whether this effect is on just a quantitative level or a qualitative one. Do you have any suggestions for this as well?

Thanks a lot again.

Son

Son Ta Dinh, M.Sc.
PhD student in Human Pain Research
Klinikum rechts der Isar
Technische Universität München
Munich, Germany
Phone: +49 89 4140 7664<tel:%2B49%2089%204140%207664>
http://www.painlabmunich.de/

Von: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] Im Auftrag von Darren Price
Gesendet: Mittwoch, 12. Oktober 2016 19:01
An: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Betreff: Re: [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes

Hi

Sorry, I don’t have time to write a long answer right now, but in short you don’t need to select a subset of channels. In fact this would not be a valid null since those subset of channels are really just picking up roughly the same signal as the unselected channels. One type of valid null (given certain assumptions) can be computed by phase randomisation of the original data (to create what is known as a surrogate dataset). The general idea is to Fourier transform each channel, randomise the phase (but not the amplitude) of each frequency component, using the same phase randomisation for each channel, and then inverse Fourier transform each channel. Don’t try to do this yourself unless you know what you are doing, as there are a couple of big pitfalls to avoid. What you will be left with is a random time domain signal, that has the same frequency components, and also (crucially) the same covariance structure between channels (so that the rank of the data is the same as your original data in each iteration), although you might not want this, and it’s not strictly necessary. If you want a proper reference then here it is. http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.73.951 .

If you want an example of how to do this in Matlab. I can provide it. It’s actually just a few lines of code. Let me know and I will send the code over.

P.S if you want your results to be reproducible you should always set your random seed at the start of your script.

Good luck.

Thanks
Darren

-------------------------------------------------------
Dr. Darren Price
Investigator Scientist and Cam-CAN Data Manager
MRC Cognition & Brain Sciences Unit
15 Chaucer Road
Cambridge, CB2 7EF
England
EMAIL:  darren.price at mrc-cbu.cam.ac.uk<mailto:darren.price at mrc-cbu.cam.ac.uk>
URL:    http://www.mrc-cbu.cam.ac.uk/people/darren.price
TEL     +44 (0)1223 355 294 x202
FAX     +44 (0)1223 359 062
MOB     +44 (0)7717822431
-------------------------------------------------------

From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Ta Dinh, Son
Sent: 12 October 2016 16:06
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes

Hey Matthew,

Thanks for the answer, but the question is exactly how to actually build a representative null distribution. As the calculation using all (64) electrodes is deterministic, it can’t really be used to create a distribution, it would just be a vector of 1000 x 1 exact same value.
The graph measure is called hub disruption index and was introduced here: Achard, S., et al. (2012). "Hubs of brain functional networks are radically reorganized in comatose patients." PNAS.
To put it in a nutshell, it compares a subject against a group of controls, thereby giving a single value for every subject (in comparison to the control group).

I hope this has cleared up the context a bit.

Best
Son

Son Ta Dinh, M.Sc.
PhD student in Human Pain Research
Klinikum rechts der Isar
Technische Universität München
Munich, Germany
Phone: +49 89 4140 7664<tel:%2B49%2089%204140%207664>
http://www.painlabmunich.de/

Von: Nickel, Moritz
Gesendet: Mittwoch, 12. Oktober 2016 16:37
An: Ta Dinh, Son <son.ta.dinh at tum.de<mailto:son.ta.dinh at tum.de>>
Betreff: Fwd: [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes

---------- Forwarded message ----------
From: Matt Gerhold <matt.gerhold at gmail.com<mailto:matt.gerhold at gmail.com>>
Date: 2016-10-05 13:31 GMT+02:00
Subject: Re: [FieldTrip] Statistical test of robustness of a graph measure based on reduced amount of nodes
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>

Hi Son,

What you are explaining sounds like resampling to build a distribution under the null hypothesis. You would need to make sure that your random draws are representative in some way of an instance where the test statistic (graph theoretic measure) is truly zero, i.e. representative of the null hypothesis. There is no info on your measure, so one can't comment any further on how one would achieve this.

Once you have the bootstrapped distribution you compute the proportion of values above the test statistic and those below the test statistic--the test statistic is the measure you got from the actual sample, not the bootstrapped distribution.

Then it depends whether you use a two-tail or one-tail test and the direction of the hypothesized effect: for a one-tail test you could potentially take the proportion of the distribution above equal to the test statistic, that would be your p-value. For two tailed-tests take the min value of the two-proportions as your p-value and remember to divide alpha by 2 to test for significance.

That, in a nutshell, is a simple approach; however, there are other ways to go about this.

Matthew

On Wed, Oct 5, 2016 at 6:54 AM, Ta Dinh, Son <son.ta.dinh at tum.de<mailto:son.ta.dinh at tum.de>> wrote:
Dear Fieldtrippers,

the general problem we are facing is one of statistics. In particular, we are trying to test the robustness of a graph measure when reducing the amount of nodes it is computed with. In our case, we use the EEG electrodes as nodes.

We are trying to find out whether a graph measure differs significantly from zero over a group of subjects. The exact calculation of the measure is rather complicated to explain, suffice it to say that every subject has exactly one scalar value in the end. Computation of this measure using 64 electrodes is straightforward and we can easily calculate a p-value and/or a confidence interval.
When we calculate based on only 32 electrodes however, we draw 32 electrodes randomly. Therefore, we need to repeat this computation many times (let’s say 1000 times). So we then get [1000 x number of subjects] values, or 1000 p-values/confidence intervals.
How do we statistically test whether the measure is robustly different from 0? Is it too naive to simply assume that if the confidence interval does not contain 0 in at least 950 of the 1000 computations then it is robustly different from 0?

Any help would be greatly appreciated!

Best regards,
Son

Son Ta Dinh, M.Sc.
PhD student in Human Pain Research
Klinikum rechts der Isar
Technische Universität München
Munich, Germany
Phone: +49 89 4140 7664<tel:%2B49%2089%204140%207664>
http://www.painlabmunich.de/

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161013/98f1af1d/attachment-0002.html>
```

More information about the fieldtrip mailing list