-
Notifications
You must be signed in to change notification settings - Fork 0
/
regression_vep_testing.asv
54 lines (36 loc) · 1.7 KB
/
regression_vep_testing.asv
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
clear
%datatype = 'vep';
datatype = 'vep_psychophysics';
group = 'NS';
%% Load relevant data
subjectList_vep;
idx = cellfun(@(x) strcmpi(x(1:2),group), sID); % select group
sID = sID(idx);
i = 1
sCond = 'congruent';
switch lower(datatype)
case 'vep'
vepDataFile = dir([cd filesep 'output_vep' filesep sID{i} '-vep-' sCond '.mat']);
load([vepDataFile.folder filesep vepDataFile.name]); % loads congruentVep
data = congruentVep; clear congruentVep vepDataFile;
vepFitFile = dir([cd filesep 'fitdata_vep' filesep 'model_fits' filesep sID{i} '_' sCond '.mat']); % vep
load([vepFitFile.folder filesep vepFitFile.name]); % loads p
modelfit = p; clear p vepFitFile;
case 'vep_psychophysics'
psyDataFile = dir([cd filesep 'output_vep_psychophysics' filesep sID{i} '-motor-' sCond '.mat']);
load([psyDataFile.folder filesep psyDataFile.name]); % loads congruentMotor;
data = congruentMotor; clear congruentMotor psyDataFile;
psyFitFile = dir([cd filesep 'fitdata_vep_psychophysics' filesep 'model_fits' filesep sID{i} '_' sCond '.mat']); %psychophysics
load([psyFitFile.folder filesep psyFitFile.name]); % loads p
modelfit = p; clear p psyFitFile;
otherwise
disp([datatype ' is an undefined datatype'])
end
% calibrate response (no model fitting is done otherwise)
[err,predModel,respJoy,respJoyCalib,t,stim,n] = b_s.getErr(modelfit, data);
% vectors
contrastLE = reshape([data.experiment.LEcontrast],1,[]);
contrastRE = reshape([data.experiment.REcontrast],1,[]);
response = reshape(cell2mat(respJoyCalib'),1,[]);
% unclear to me if it's a good idea to zero-center, skip for now
mod = fitlm()