-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfig_solway2.m
174 lines (131 loc) · 4.05 KB
/
fig_solway2.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
function fig_solway2(filename, do_save)
null = [];
corr = [];
if ~exist('filename', 'var') || isempty(filename)
%load('solway2.mat');
%load('solway2_alpha=5_nsamples=1000.mat'); % <-- preprint
%load old_mats/solway2_N=10_alpha=1.0000_nsamples=10000_last.mat % <-- sample_c repro
%load solway2_N=10_alpha=1.0000_nsamples=10000_last.mat % sample_c
load solway2_N=10_alpha=1.0000_nsamples=10000_eps=0.6000_last.mat % sample_c
%load('solway2_alpha=2_nsamples=100.mat');
else
load(filename);
end
if ~exist('do_save', 'var')
do_save = true;
end
figure('pos', [2000 1200 1000 600] * 3/4);
fontsize = 13;
axisfontsize = 10;
lettersize = 14;
% A: graph
%
subplot(2,3,1);
h = plot_solway2_graph(H, D);
d = 0.1;
text(h.XData(9), h.YData(9) , 's', 'FontSize', 10, 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle');
text(h.XData(16) , h.YData(16) + d, 'g', 'FontSize', 10, 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle');
%labelnode(h, 9, ' start');
%labelnode(h, 16, ' goal');
title('Experimental Design', 'fontsize', fontsize);
% B: Data
%
sizes = (100 - 74) * ones(1,19) / 18;
sizes(10) = 74;
sizes = sizes * 0.15;
ax = subplot(2,3,2);
h = plot_solway2_graph(H, D);
for i = 1:D.G.N
highlight(h, i, 'NodeColor', [0.6 0.6 0.6], 'MarkerSize', 12 + sizes(i));
end
hold on;
plot_solway2_graph(H, D);
hold off;
title('Data', 'fontsize', fontsize);
axes('Position', [ax.Position(1) ax.Position(2) 0.07 0.12]);
box on;
for j = 1:null_iters
null_p(j) = mean(null{j}(corr(:)) == 10);
end
null_p = sort(null_p);
lcb = null_p(length(null_p) * 0.025);
ucb = null_p(length(null_p) * 0.975);
m = 0.74;
bar(m);
hold on;
line([0 2], [mean(null_p) mean(null_p)], 'linestyle', '--', 'color', [0.6 0.6 0.6]);
%h = fill([0 2 2 0], [lcb lcb ucb ucb], [0.4 0.4 0.4]);
%set(h, 'facealpha', 0.5, 'edgecolor', 'none');
set(gca, 'xlim', [0 2]);
set(gca, 'ylim', [0 1]);
set(gca, 'ytick', [0 0.5 1]);
xticklabels({'P(choose bottleneck)'});
hold off;
% C: Model
ax = subplot(2,3,3);
h = plot_solway2_graph(H, D);
for i = 1:D.G.N
f = sum(loc(corr(:)) == i);
f = f / sum(corr(:)) * sum(sizes);
highlight(h, i, 'NodeColor', [0.6 0.6 0.6], 'MarkerSize', 12 + f);
end
hold on;
plot_solway2_graph(H, D);
hold off;
title('Model', 'fontsize', fontsize);
axes('Position', [ax.Position(1) ax.Position(2) 0.07 0.12]);
box on;
for j = 1:null_iters
null_p(j) = mean(null{j}(corr(:)) == 10);
end
null_p = sort(null_p);
lcb = null_p(length(null_p) * 0.025);
ucb = null_p(length(null_p) * 0.975);
m = mean(p);
se = sem(p);
bar(m);
hold on;
errorbar(m, se, 'color', 'black');
line([0 2], [mean(null_p) mean(null_p)], 'linestyle', '--', 'color', [0.6 0.6 0.6]);
%h = fill([0 2 2 0], [lcb lcb ucb ucb], [0.4 0.4 0.4]);
%set(h, 'facealpha', 0.5, 'edgecolor', 'none');
set(gca, 'xlim', [0 2]);
set(gca, 'ylim', [0 1]);
set(gca, 'ytick', [0 0.5 1]);
xticklabels({'P(choose bottleneck)'});
hold off;
% D: Hierarchies
%{
x = [-3 -2 -1 -3 -2 -1 -3 -2 -1 0 1 2 3 1 2 3 1 2 3];
y = [-1 -1 -1 0 0 0 1 1 1 0 -1 -1 -1 0 0 0 1 1 1];
for s = 1:10
subplot(4,5, 10 + s);
h = plot_H(chosen_H{s}, D);
set(h, 'XData', x);
set(h, 'YData', y);
labelnode(h, 1:D.G.N, '');
set(gca, 'xtick', []);
set(gca, 'ytick', []);
set(gca, 'ylim', [-3 3]);
if s == 3
title('Example hierarchies', 'fontsize', fontsize);
end
end
%}
ax1 = axes('Position',[0 0 1 1],'Visible','off');
axes(ax1);
text(0.10, 0.96, 'A', 'FontSize', lettersize, 'FontWeight', 'bold');
text(0.36, 0.96, 'B', 'FontSize', lettersize, 'FontWeight', 'bold');
text(0.64, 0.96, 'C', 'FontSize', lettersize, 'FontWeight', 'bold');
%text(0.10, 0.52, 'D', 'FontSize', lettersize, 'FontWeight', 'bold');
% save figure
if do_save
h = gcf;
%set(h, 'PaperPositionMode', 'auto');
set(h, 'PaperOrientation', 'landscape');
print('figures/solway2.pdf', '-dpdf');
end
% stats
%
pvalue = mean(null_p >= m); % what fraction of the null is "better" than m? = P(we got a value as extreme as m under the null)
fprintf('%f; MC test (%d samples from null), p = %e\n', m, null_iters, pvalue);