-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_statistics_paper1.m
274 lines (189 loc) · 5.45 KB
/
plot_statistics_paper1.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
function plot_statistics_paper1(path_code, path_control,path_emcs, path_mcs, ...
path_uws, MSA, time_analysis)
cd(path_control);
SUBJlist_Control = dir('*.mat');
for i = 1:length(SUBJlist_Control)
SUBJname_Control = SUBJlist_Control(i).name;
% path1=([path SUBJname]);
% cd(path1);
data=load(SUBJname_Control);
if(MSA)
Control_aux(i,:,:) = data.aux;
else
if(time_analysis == 1440)
Control_aux(i,:,:) = data.aux(1:1400);
end
Control_aux(i,:,:) = data.aux;
end
end
if(MSA)
t_control = data.time;
else
if(time_analysis == 1440)
t_control = data.t_aux(1):data.t_aux(2)-40; % to avoid effects of boundary
end
t_control = data.t_aux(1):data.t_aux(2);
end
% figure
% plot(t_control, Control_aux');
%%%%%% Import data for Group 2: EMCSs
cd(path_emcs);
SUBJlist_EMCS = dir('EMC*.mat');
for i = 1:length(SUBJlist_EMCS)
SUBJname_EMCS = SUBJlist_EMCS(i).name;
% path1=([path SUBJname]);
% cd(path1);
data=load(SUBJname_EMCS);
if(MSA)
EMCS_aux(i,:,:) = data.aux;
else
if(time_analysis == 1440)
EMCS_aux(i,:,:)= data.aux(1:1400);
end
EMCS_aux(i,:,:)= data.aux;
end
end
if(MSA)
t_emcs = data.time;
else
if(time_analysis == 1440)
t_emcs = data.t_aux(1):data.t_aux(2)-40; % to avoid effects of boundary
end
t_emcs = data.t_aux(1):data.t_aux(2);
end
% figure
% plot(t_emc,EMCS_aux');
%%%%%% Import data for the MCS Group
cd(path_mcs);
SUBJlist_MCS = dir('MCS_*.mat');
for i = 1:length(SUBJlist_MCS)
SUBJname_MCS = SUBJlist_MCS(i).name;
data=load(SUBJname_MCS);
if(MSA)
MCS_aux(i,:,:) = data.aux;
else
MCS_aux(i,:,:)= data.aux(1:1400);
end
end
if(MSA)
t_mcs = data.time;
else
t_mcs = data.t_aux(1):data.t_aux(2)-40;
end
% figure
% plot(t_mcs,MCS_aux');
%%%%%% import data for group 5: UWS
cd(path_uws);
SUBJlist_UWS = dir('UWS_*.mat');
for i = 1:length(SUBJlist_UWS)
SUBJname_UWS = SUBJlist_UWS(i).name;
% path1=([path SUBJname]);
% cd(path1);
data=load(SUBJname_UWS);
if(MSA)
UWS_aux(i,:,:) = data.aux;
else
UWS_aux(i,:,:)= data.aux(1:1400);
end
end
if(MSA)
t_uws = data.time;
else
t_uws = data.t_aux(1):data.t_aux(2) - 40;
end
% figure
% plot(t_uws,UWS_aux');
%%%%%% import data for group 5-b: UWS*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Ploting
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Control vs EMCS
mean_SE_Controls = mean(Controls_,2);
std_SE_Controls = std(Controls_,[], 2);
figure
if(time_analysis == 1440)
y2_CC = mean(Control_aux);
z2_CC = std(Control_aux)/sqrt (length(Control_aux));
y3_CC = mean (EMCS_aux);
z3_CC = std (EMCS_aux)/sqrt (length(EMCS_aux));
else
y2_CC = mean(Control_aux,2);
std_SE_Controls = std(Control_aux,[], 2);
z2_CC = std_SE_Controls/sqrt (length(y2_CC));
y3_CC = mean (EMCS_aux,2);
std_SE_EMCS = std(EMCS_aux,[], 2);
z3_CC = std_SE_EMCS/sqrt (length(y3_CC));
end
errorbar(t_control,y2_CC,z2_CC, 'b'); grid on;
hold on
%y3_CC(isnan(y3_CC)) = nanmedian(y3_CC);
errorbar (t_emcs, y3_CC,z3_CC, 'r'); grid on;
title( 'Control (blue) vs EMCS (red)')
if(MSA)
ylabel('Mean Spectral Amplitude (MSA)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
else
ylabel('Spectral Entropy (SE)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
end
[h_EMCS_aux,p_EMCS_aux] = ttest2(Control_aux,EMCS_aux,0.05);
% Control vs MCS
figure
y2_CC = mean(Control_aux);
z2_CC = std(Control_aux)/sqrt (length(Control_aux));
errorbar(t_control,y2_CC,z2_CC, 'b'); grid on;
hold on
y3_CC = mean (MCS_aux);
z3_CC = std (MCS_aux)/sqrt (length(MCS_aux));
errorbar (t_mcs, y3_CC,z3_CC, 'r'); grid on;
title( 'Control (blue) vs MCS (red)' )
if(MSA)
ylabel('Mean Spectral Amplitude (MSA)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
else
ylabel('Spectral Entropy (SE)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
end
[h_MCS_aux,p_MCS_aux] = ttest2(Control_aux,MCS_aux,0.05);
% Control vs UWS
figure
y2_CC = mean(Control_aux);
z2_CC = std(Control_aux)/sqrt (length(Control_aux));
errorbar(t_control,y2_CC,z2_CC, 'b'); grid on;
hold on
y3_CC = mean (UWS_aux);
z3_CC = std (UWS_aux)/sqrt (length(UWS_aux));
errorbar (t_uws, y3_CC,z3_CC, 'r'); grid on;
title('Control (blue) vs UWS (red)')
if(MSA)
ylabel('Mean Spectral Amplitude (MSA)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
else
ylabel('Spectral Entropy (SE)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
end
[h_UWS_aux,p_UWS_aux] = ttest2(Control_aux,UWS_aux,0.05);
% MCS vs UWS
figure
y2_CC = mean(MCS_aux);
z2_CC = std(MCS_aux)/sqrt (length(MCS_aux));
errorbar(t_mcs,y2_CC,z2_CC, 'b'); grid on;
hold on
y3_CC = mean (UWS_aux);
z3_CC = std (UWS_aux)/sqrt (length(UWS_aux));
errorbar (t_uws, y3_CC,z3_CC, 'r'); grid on;
title('MCS (blue) vs UWS (red)')
if(MSA)
ylabel('Mean Spectral Amplitude (MSA)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
else
ylabel('Spectral Entropy (SE)', 'FontSize',14,'FontWeight','bold','Color','k')
xlabel('time (min)');
end
[h_UWS_aux,p_UWS_aux] = ttest2(Control_aux,UWS_aux,0.05)
cd(path_code);
end