-
Notifications
You must be signed in to change notification settings - Fork 4
/
plot_all_MEG.m
194 lines (147 loc) · 5.65 KB
/
plot_all_MEG.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
% Code to fit the history-dependent drift diffusion models as described in
% Urai AE, de Gee JW, Tsetsos K, Donner TH (2019) Choice history biases subsequent evidence accumulation. eLife, in press.
%
% MIT License
% Copyright (c) Anne Urai, 2019
%% ========================================== %
% determine how the figures will look
% ========================================== %
clear all; clc; close all;
set(groot, 'defaultaxesfontsize', 6, 'defaultaxestitlefontsizemultiplier', 1.1, ...
'defaultaxeslabelfontsizemultiplier', 1.1, ...
'defaultaxestitlefontweight', 'bold', ...
'defaultfigurerenderermode', 'manual', 'defaultfigurerenderer', 'painters', ...
'DefaultAxesBox', 'off', ...
'DefaultAxesTickLength', [0.02 0.05], 'defaultaxestickdir', 'out', 'DefaultAxesTickDirMode', 'manual', ...
'defaultfigurecolormap', [1 1 1], 'defaultTextInterpreter','tex', ...
'DefaultFigureWindowStyle','normal');
global datasets datasetnames mypath colors
dbstop if error % for debugging
usr = getenv('USER');
switch usr
case {'anne', 'urai'}
mypath = '~/Data/HDDM';
case 'aeurai'
mypath = '/home/aeurai/Data/HDDM';
end
datasets = {'MEG_MEGdata'}
datasetnames = {{'Visual motion 2IFC' 'MEG trials'}}
% go to code folder
try
addpath(genpath('~/code/Tools'));
cd('/Users/urai/Documents/code/serialDDM');
end
% from Thomas, green; blue; darkteal
colors = [77,175,74; 55,126,184; 52, 103, 51] ./ 256; % green blue
% ========================================== %
% PREPARING DATA
% This will generate the allindividualresults.csv files
% ========================================== %
if 1,
read_into_Matlab(datasets);
% read_into_Matlab_gSquare(datasets);
make_dataframe(datasets);
rename_PPC_files(datasets);
end
disp('starting visualization');
% ========================================== %
% FIGURE 2
% ========================================== %
repetition_range;
strategy_plot;
% ========================================== %
% FIGURE 3
% ========================================== %
barplots_modelcomparison;
% ========================================== %
% FIGURE 4
% ========================================== %
alldat = individual_correlation_main(0, 0); % figure 4
forestPlot(alldat);
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_st%d_HDDM.pdf', 0));
% ========================================== %
% FIGURE 5
% % ========================================== %
% alldat = individual_correlation_prevcorrect;
% % separate plots for correct and error
% forestPlot(alldat(1:2:end));
% print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_HDDM_prevcorrect.pdf'));
% forestPlot(alldat(2:2:end));
% print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_HDDM_preverror.pdf'));
% % compare the correlation coefficients for figure 5d
% compare_correlations_correct_error(alldat);
% DIC comparison
%vbarplots_DIC_previousresponse_outcome;
% ========================================== %
% SUPPLEMENTARY FIGURE 1
% ========================================== %
% see graphicalModels.manualGraphical.py
% run in Python: plot_HDDM_priors.py
% ========================================== %
% SUPPLEMENTARY FIGURE 2
% ========================================== %
% dprime_driftrate_correlation;
% posterior_predictive_checks;
% history_kernels;
% strategy_plot_2-7;
% ========================================== %
% SUPPLEMENTARY FIGURE 3
% ========================================== %
plot_posteriors;
% ========================================== %
% SUPPLEMENTARY FIGURE 4
% ========================================== %
% a. G-square fit
alldat = individual_correlation_main(1, 0);
forestPlot(alldat);
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_st%d_Gsq.pdf', 0));
barplots_BIC;
% b. fit with between-trial variability in non-decision time
alldat = individual_correlation_main(0, 1); %
forestPlot(alldat);
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_st%d_HDDM.pdf', 1));
% c. added non-decision time between coherence levels
nondecisiontime_coherence;
barplots_DIC_stcoh;
alldat = individual_correlation_tcoh(); % figure 4
forestPlot(alldat);
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_tcoh_HDDM.pdf'));
% ========================================== %
% SUPPLEMENTARY FIGURE 5
% ========================================== %
alldat = individual_correlation_pharma();
forestPlot(fliplr(alldat));
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_pharma.pdf'));
% ========================================== %
% SUPPLEMENTARY FIGURE 6
% ========================================== %
post_error_slowing;
% ========================================== %
% SUPPLEMENTARY FIGURE 7
% ========================================== %
barplots_modelcomparison_regression;
% ========================================== %
% SUPPLEMENTARY FIGURE 9
% see JW's code in simulations/ folder
% ========================================== %
% ========================================== %
% MEG REGRESSION RESULTS
% FOR SFN2018 POSTER
% ========================================== %
meg_regression_dic;
meg_regression_posteriors;
% ========================================== %
% repeaters vs alternators
% ========================================== %
individual_correlations_repeaters_vs_alternators;
% ========================================== %
% combine post-error slowing with choice history
% ========================================== %
alldat = individual_correlation_PES; % figure 4
forestPlot(alldat);
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/forestplot_PES_HDDM.pdf'));
% ========================================== %
% CUMULATIVE P(REPEAT)
% ========================================== %
cumulative_prepeat;