-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_vep_modelcomparisons_individuals.m
128 lines (110 loc) · 4.69 KB
/
plot_vep_modelcomparisons_individuals.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
%% Plots model fits
% Makes 4 figures, one for each model (mean, max, minkowski, mixture)
% Each figure shows plots for all participant fits
%datatype = 'vep';
datatype = 'vep_psychophysics';
sGroup = 'NS';
sCondition = 'congruent';
%% Load relevant data
all_data = [];
switch lower(datatype)
case 'vep'
vepFolder = [cd filesep 'fitdata_vep' filesep 'model_fits']; % vep
vepFiles = dir([vepFolder filesep sGroup '_*' sCondition '.mat']); % grab NS only right now
for i = 1:length(vepFiles)
load([vepFiles(i).folder filesep vepFiles(i).name]);
all_data = [all_data p];
clear p
end
case 'vep_psychophysics'
psyFolder = [cd filesep 'fitdata_vep_psychophysics' filesep 'model_fits']; %psychophysics
psyFiles = dir([psyFolder filesep sGroup '_*' sCondition '.mat']);
for i = 1:length(psyFiles)
load([psyFiles(i).folder filesep psyFiles(i).name]);
all_data = [all_data p];
clear p
end
otherwise
disp([datatype ' is an undefined datatype'])
end
%% plot setting
n = size(all_data,2);
numRows = ceil(n / 4);
%% Mean model
fig4 = figure(4); clf; hold on;
set(gcf, "Name", [datatype ', ' sCondition ' data: Mean model fits'])
for i = 1:n
subplot(numRows, 4, i); hold on;
oneSubjectPlot(all_data(i).predModel_meanModel, all_data(i).meanResponseScaled, all_data(i).sID)
text(200, 0.1, ['err = ' num2str(all_data(i).meanModelErr,2)], 'color', 'b')
ylabel('contrast');
end
text(800,.8, 'Mean prediction in red (L+R)/2', 'color', 'r')
text(800,.6, 'response in black', 'color', 'k')
%% Max model
fig5 = figure(5); clf; hold on;
set(gcf, "Name", [datatype ', ' sCondition ' data: Max model fits'])
for i = 1:n
subplot(numRows, 4, i); hold on;
oneSubjectPlot(all_data(i).predModel_maxModel, all_data(i).meanResponseScaled, all_data(i).sID)
text(200, 0.1, ['err = ' num2str(all_data(i).maxModelErr,2)], 'color', 'b')
ylabel('contrast');
end
text(800,.8, 'Max prediction in red max(L,R)', 'color', 'r')
text(800,.6, 'response in black', 'color', 'k')
%% Minkwoski
fig6 = figure(6); clf; hold on;
set(gcf, "Name", [datatype ', ' sCondition ' data: Minkowski fits'])
for i = 1:n
subplot(numRows, 4, i); hold on;
oneSubjectPlot(all_data(i).predModel_minkModel, all_data(i).meanResponseScaled, all_data(i).sID)
text(200, 0.2, ['m = ' num2str(all_data(i).n,2)], 'color', 'r')
text(200, 0.1, ['err = ' num2str(all_data(i).minkModelErr,2)], 'color', 'b')
ylabel('contrast');
end
text(800,.8, 'Minkowski prediction in red ([L^m+R^m]/2)^(^1^/^m^)', 'color', 'r')
text(800,.6, 'response in black', 'color', 'k')
%% Mean/max weighting
fig7 = figure(7); clf; hold on;
set(gcf, "Name", [datatype ', ' sCondition ' data: mean/max mixture model fits'])
for i = 1:n
subplot(numRows, 4, i); hold on;
oneSubjectPlot(all_data(i).predModel_mnmxwghtModel, all_data(i).meanResponseScaled, all_data(i).sID)
text(200, 0.2, ['w = ' num2str(all_data(i).w,2)], 'color', 'r')
text(200, 0.1, ['err = ' num2str(all_data(i).mnmxwghtModelErr,2)], 'color', 'b')
ylabel('contrast');
end
text(800,.8, 'Mean/max weighting in red (1-w)*mean + (w)*max', 'color', 'r')
text(800,.6, 'response in black', 'color', 'k')
%% Minowski weighted
%
% fig8= figure(8); clf; hold on;
% set(gcf, "Name", [datatype ', ' sCondition ' data: Weighted Minkowski fits'])
% for i = 1:n
% subplot(numRows, 4, i); hold on;
% oneSubjectPlot(all_data(i).predModel_minkwghtModel, all_data(i).meanResponseScaled, all_data(i).sID)
% text(200, 0.2, ['m = ' num2str(all_data(i).mink_wghtd_p,2) ' w = ' num2str(all_data(i).mink_wghtd_w,2) ], 'color', 'r')
% text(200, 0.1, ['err = ' num2str(all_data(i).minkwghtModelErr,2)], 'color', 'b')
% ylabel('contrast');
% end
% text(800,.8, 'Minkowski prediction in red ([(w)L^m+(2-w)R^m]/2)^(^1^/^m^)', 'color', 'r')
% text(800,.6, 'response in black', 'color', 'k')
%% weghted mean
fig9=figure(9); clf; hold on;
set(gcf, "Name", [datatype ', ' sCondition ' data: Weighted Mean fits'])
for i = 1:n
subplot(numRows, 4, i); hold on;
oneSubjectPlot(all_data(i).predModel_wghtAvg, all_data(i).meanResponseScaledByEye, all_data(i).sID)
text(200, 0.2, ['m = ' num2str(all_data(i).wa,2) ' w = ' num2str(all_data(i).wa,2) ], 'color', 'r')
text(200, 0.1, ['err = ' num2str(all_data(i).wghtAvg_err,2)], 'color', 'b')
ylabel('contrast');
end
text(800,.8, 'Weighted average in red w*L + (1-w)*R', 'color', 'r')
text(800,.6, 'response in black', 'color', 'k')
%%
function oneSubjectPlot(predModelData, meanResponseData, sID)
plot(predModelData, 'r');
plot(meanResponseData, 'k');
title(sID, 'Interpreter', 'none');
xlim([1 length(meanResponseData)]); ylim([0 1]);
end