forked from anne-urai/2019_Urai_choice-history-ddm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repetition_range.m
55 lines (44 loc) · 1.74 KB
/
repetition_range.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
function repetition_range
% Code to fit the history-dependent drift diffusion models described in
% Urai AE, Gee JW de, Donner TH (2018) Choice history biases subsequent evidence accumulation. bioRxiv:251595
%
% MIT License
% Copyright (c) Anne Urai, 2018
% anne.urai@gmail.com
global mypath datasets datasetnames
addpath(genpath('~/code/Tools'));
warning off; close all;
cmap = viridis(256);
colormap(cmap);
markers = {'d', 's', '^', 'v', '>', '<'};
colors = cbrewer('qual', 'Set2', length(datasets));
for d = 1:length(datasets),
close all;
subplot(4,4,1); hold on;
dat = readtable(sprintf('%s/summary/%s/allindividualresults.csv', mypath, datasets{d}));
dat = dat(dat.session == 0, :);
if d == 5
dat(dat.subjnr == 11, :) = [];
end
rep = sort(dat.repetition);
b = barh(rep, 'facecolor', [0.5 0.5 0.5], 'basevalue', 0.5, 'edgecolor', 'none');
plot([0.5 0.5],[0.5 numel(rep)+0.5], 'k');
b(1).BaseLine.LineStyle = 'none';
% ylabel(sprintf('%s, n = %d', datasetnames{d}{1}, numel(rep)));
% show on x-axis what the mean is
box off; xlim([0.4 0.65]); ylim([1 numel(rep)+0.5]);
plot(mean(rep), 0, 'marker', markers{d}, 'markerfacecolor', ...
'w', 'markeredgecolor', colors(d, :), 'markersize', 5);
set(gca, 'ytick', [1 numel(rep)], 'xtick', [0.4 0.5 0.6]);
ylabel('# Observers')
if d == length(datasets),
xlabel('P(repeat)');
else
set(gca, 'xticklabel', []);
end
try; offsetAxes; end % sometimes throws an error
set(gca, 'xcolor', 'k', 'ycolor', 'k');
tightfig;
print(gcf, '-dpdf', sprintf('~/Data/serialHDDM/repetitionRange_d%d.pdf',d));
% print(gcf, '-depsc', sprintf('~/Data/serialHDDM/repetitionRange_d%d.eps',d));
end