-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmainEffect.m
138 lines (116 loc) · 3.39 KB
/
mainEffect.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
% produce Fig. 4 in the paper
Xdata1 = XdataEye;
factors = {'backMirror', 'pupilMean', 'fMax', 'fStd', 'pupilStd', 'road', 'fMean','sAmpMean', 'sAmpStd'};
close all
figure
for i = 1 : size(Xdata,2)
temp = Xdata1(:,i);
if length(unique(temp))>100
[temp,E] = discretize(temp,18);
Xdata1(:,i) = temp;
subplot(3,3,i)
yyaxis left
boxplot(SHAPEye(:,i), Xdata1(:,i))
set(findobj(gca,'type','line'),'linew',1)
yyaxis right
histogram(temp,'FaceAlpha',.05)
ylim([0 1000])
if i == 2
E = round(E,1);
elseif i==5
E = round(E,2);
end
xticklabels(num2cell(E))
xlabel(factors{i})
else
subplot(3,3,i)
yyaxis left
Xpos = unique(temp);
boxplot(SHAPEye(:,i), Xdata1(:,i),'positions', Xpos, 'labels', Xpos)
set(findobj(gca,'type','line'),'linew',1)
yyaxis right
if i == 7
histogram(temp,20,'FaceAlpha',.1)
ylim([0 1000])
else
histogram(temp,'FaceAlpha',.05)
ylim([0 1000])
end
temp = sort(unique(temp));
%xticklabels(num2cell(temp'))
xlabel(factors{i})
end
end
[r, p]=corr(Xdata,SHAPEye);
p = diag(p)
r = diag(r)
%% Produce Fig. 3 in the paper
Xdata1 = XdataAll;
factors = {'videoLength', 'correctDecision', 'decisionTime',...
'difficulty', 'backMirror', 'drivingFrequency', 'pupilMean',...
'decisionMade', 'fMean', 'age', 'road', 'pupilChange', 'danger','fMax'};
close all
Ind = 1:14;
usefactors = factors(Ind);
figure
for j = 1 : length(Ind)
i = Ind(j);
temp = Xdata1(:,i);
if length(unique(temp))>50
[temp,E] = discretize(temp,18);
E = round(E,1);
Xdata1(:,i) = temp;
subplot(5,3,j)
yyaxis left
boxplot(SHAPAll(:,i), Xdata1(:,i))
set(findobj(gca,'type','line'),'linew',1)
yyaxis right
histogram(temp,'FaceAlpha',.05)
ylim([0 1000])
if i == 3 || i==7
E = round(E,1);
elseif i == 12
E = round(E,2);
elseif i==4||i==8||i==13
E = round(E);
end
xticklabels(num2cell(E))
xlabel(usefactors{j})
else
subplot(5,3,j)
yyaxis right
% if i == 1
% edges = [0 2 5 7 10 15];
% histogram(temp,edges,'FaceAlpha',.05)
% ylim([0 1000])
% else
if j == 1
histogram(temp,'FaceAlpha',.05)
ylim([0 1000])
xlim([min(temp) max(temp)])
temp1 = sort(unique(temp));
xticklabels(temp1')
xlabel(usefactors{j})
else
histogram(temp,'FaceAlpha',.05)
ylim([0 1000])
temp = sort(unique(temp));
xticklabels(num2cell(temp'))
xlabel(usefactors{j})
end
yyaxis left
Xpos = unique(temp);
boxplot(SHAPAll(:,i), Xdata1(:,i),'positions', Xpos, 'labels', Xpos)
set(findobj(gca,'type','line'),'linew',1)
end
end
%%
[r, p]=corr(XdataAll,SHAPAll);
p = diag(p)
r = diag(r)
[r, p]=corr(XdataAll,SHAPAll,'Type','Spearman');
ind = [1 2 6 8];
p = diag(p)
r = diag(r)
p(ind)
r(ind)