-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnalysisReviewer3.m
235 lines (192 loc) · 5.84 KB
/
AnalysisReviewer3.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
clear all
path2=[ '../../Nonequilibrium/'];
addpath(genpath(path2));
path3=[ '../../Fluctuations_FDT/Classify_FDT'];
addpath(genpath(path3));
load results_Ceff_psilodep2.mat;
load psilodep2_extrainfo.mat;
load BDI_baseline.mat;
load psilodep2_gender.mat;
idx_P=find(drug==2);
idx_E=find(drug==1);
idx_P_Nresp=find(BDIresponse(idx_P)==0);
idx_P_resp=find(BDIresponse(idx_P)==1);
idx_E_Nresp=find(BDIresponse(idx_E)==0);
idx_E_resp=find(BDIresponse(idx_E)==1);
idx_P_male=find(gender(idx_P)==1);
idx_P_female=find(gender(idx_P)==0);
idx_E_male=find(gender(idx_E)==1);
idx_E_female=find(gender(idx_E)==0);
%% Gender
figure(1)
subplot(2,2,1)
a=trophiccoherencePB(idx_P_female);
b=trophiccoherencePA(idx_P_female);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
subplot(2,2,2)
a=trophiccoherencePB(idx_P_male);
b=trophiccoherencePA(idx_P_male);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
subplot(2,2,3)
a=trophiccoherenceEB(idx_E_female);
b=trophiccoherenceEA(idx_E_female);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
subplot(2,2,4)
a=trophiccoherenceEB(idx_E_male);
b=trophiccoherenceEA(idx_E_male);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
%%
aa=BDI_baseline>23;
bb=BDIscore<-10;
cc=aa+bb;
dd=cc>1;
idx_P_similarBDI=find(dd(idx_P)==1);
idx_E_similarBDI=find(dd(idx_E)==1);
%%% similar Baseline and scorechange
figure(1);
a=trophiccoherencePB(idx_P_similarBDI);
b=trophiccoherencePA(idx_P_similarBDI);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
figure(2);
a=trophiccoherenceEB(idx_E_similarBDI);
b=trophiccoherenceEA(idx_E_similarBDI);
boxplot([a' b']);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ttest2');
min(stats.pvals)
%%
figure(1);
a=trophiccoherencePB(idx_P_resp);
b=trophiccoherencePA(idx_P_resp);
boxplot([a' b']);
signrank(a,b)
figure(2);
a=trophiccoherenceEB(idx_E_resp);
b=trophiccoherenceEA(idx_E_resp);
boxplot([a' b']);
signrank(a,b)
figure(3);
a2=trophiccoherenceEB(idx_E_Nresp);
b2=trophiccoherenceEA(idx_E_Nresp);
boxplot([a2' b2']);
signrank(a2,b2)
figure(4)
boxplot([(b-a)' ;(b2-a2)'],[ones(length((b-a)'),1)', 2*ones(length((b2-a2)'),1)']);
ranksum(b-a,b2-a2)
%%% FCtau
clear all
path2=[ '../../Nonequilibrium/'];
addpath(genpath(path2));
path3=[ '../../Fluctuations_FDT/Classify_FDT'];
addpath(genpath(path3));
N=80;
indexN=1:N; %[1:31 50:80]; %% Cortical areas
% Parameters of the data
TR=1.25; % Repetition Time (seconds)
% Bandpass filter settings
fnq=1/(2*TR); % Nyquist frequency
flp = 0.008; % lowpass frequency of filter (Hz)
fhi = 0.08; % highpass
Wn=[flp/fnq fhi/fnq]; % butterworth bandpass non-dimensional frequency
k=2; % 2nd order butterworth filter
[bfilt,afilt]=butter(k,Wn); % construct the filter
load psilodep2_extrainfo.mat;
NSUB_P=length(find(drug==2));
NSUB_E=length(find(drug==1));
idx_P=find(drug==2);
idx_E=find(drug==1);
%%
%% Psilo Before
load psilodep2_before.mat;
Tau=2;
NSUB=42;
%% Group
for nsub=1:NSUB
ts=psilodep2_before{nsub,1}; % fMRI PB
clear signal_filt;
for seed=1:N
ts(seed,:)=detrend(ts(seed,:)-nanmean(ts(seed,:)));
end
% FC(0)
ts2=ts(indexN,10:end-10);
Tm=size(ts2,2);
FCe=corrcoef(ts2');
FCemp=corr(ts2(:,1:Tm-Tau)',ts2(:,1+Tau:Tm)');
FCemp=FCemp-eye(N).*diag(FCemp);
vec=FCemp-FCemp';
FCTauB(nsub)=mean(mean(abs(vec)));
FCB(nsub)=mean(mean(abs(FCe)));
end
load psilodep2_after.mat;
for nsub=1:NSUB
ts=psilodep2_after{nsub,1}; % fMRI PB
clear signal_filt;
for seed=1:N
ts(seed,:)=detrend(ts(seed,:)-nanmean(ts(seed,:)));
end
% FC(0)
ts2=ts(indexN,10:end-10);
Tm=size(ts2,2);
FCe=corrcoef(ts2');
FCemp=corr(ts2(:,1:Tm-Tau)',ts2(:,1+Tau:Tm)');
FCemp=FCemp-eye(N).*diag(FCemp);
vec=FCemp-FCemp';
FCTauA(nsub)=mean(mean(abs(vec)));
FCA(nsub)=mean(mean(abs(FCe)));
end
figure(1);
subplot(2,2,1)
boxplot([FCB(idx_P)' FCA(idx_P)']);
a=FCB(idx_P);
b=FCA(idx_P);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'signrank');
min(stats.pvals)
subplot(2,2,2)
boxplot([FCB(idx_E)' FCA(idx_E)']);
a=FCB(idx_E);
b=FCA(idx_E);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'signrank');
min(stats.pvals)
subplot(2,2,3)
boxplot([FCTauB(idx_P)' FCTauA(idx_P)']);
a=FCTauB(idx_P);
b=FCTauA(idx_P);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'signrank');
min(stats.pvals)
subplot(2,2,4)
boxplot([FCTauB(idx_E)' FCTauA(idx_E)']);
a=FCTauB(idx_E);
b=FCTauA(idx_E);
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'signrank');
min(stats.pvals)
%%% Analysis per Node
hierarchicallevelsPBm=squeeze(mean(hierarchicallevelsPB));
hierarchicallevelsPAm=squeeze(mean(hierarchicallevelsPA));
hierarchicallevelsEBm=squeeze(mean(hierarchicallevelsEB));
hierarchicallevelsEAm=squeeze(mean(hierarchicallevelsEA));
diffP=hierarchicallevelsPBm-hierarchicallevelsPAm;
diffE=hierarchicallevelsEBm-hierarchicallevelsEAm;
boxplot([diffP' diffE']);
a=diffP;
b=diffE;
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ranksum');
min(stats.pvals)
for i=1:N
i
dif1=hierarchicallevelsPB-hierarchicallevelsPA;
dif2=hierarchicallevelsEB-hierarchicallevelsEA;
a=dif1(:,i)';
b=dif2(:,i)';
stats=permutation_htest2_np([a,b],[ones(1,numel(a)) 2*ones(1,numel(b))],10000,0.01,'ranksum');
pp(i)=min(stats.pvals);
end
nodos=FDR_benjHoch(pp,0.05)