-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSPM_contrast_manager_job.m
100 lines (80 loc) · 6.45 KB
/
SPM_contrast_manager_job.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
%-----------------------------------------------------------------------
% Job saved on 06-Dec-2019 18:00:32 by cfg_util (rev $Rev: 7345 $)
% spm SPM - SPM12 (7487)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
% load the results_dir variable - to ensure the path we use in this script
% matches the output folder specified in SPM_batch.m
load results_dir
% load the which_contrasts settings, so that we know which set of contrast
% matrices we should use below
load which_contrasts
matlabbatch{1}.spm.stats.con.spmmat = {[results_dir 'SPM.mat']};
% To construct the appropriate contrast matrices, simply use:
% Con = spm_make_contrasts([3 3]); % for a 3x3 design
if strcmp(which_contrasts, '3x3')
matlabbatch{1}.spm.stats.con.consess{1}.fcon.name = 'Main effect of Factor A (Context)';
matlabbatch{1}.spm.stats.con.consess{1}.fcon.weights = [1 1 1 -1 -1 -1 0 0 0
0 0 0 1 1 1 -1 -1 -1]; % we don't need to put in zeros(1,24) - SPM will autoly fill the 24 trailing cells with 0
%matlabbatch{1}.spm.stats.con.consess{1}.fcon.weights = [1 -1 0 0 0 0 0.333333333333333 0.333333333333333 0.333333333333333 -0.333333333333333 -0.333333333333333 -0.333333333333333 0 0 0
% 0 1 -1 0 0 0 0 0 0 0.333333333333333 0.333333333333333 0.333333333333333 -0.333333333333333 -0.333333333333333 -0.333333333333333];
matlabbatch{1}.spm.stats.con.consess{1}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{2}.fcon.name = 'Main effect of Factor B (Ttype)';
matlabbatch{1}.spm.stats.con.consess{2}.fcon.weights = [1 -1 0 1 -1 0 1 -1 0
0 1 -1 0 1 -1 0 1 -1];
%matlabbatch{1}.spm.stats.con.consess{2}.fcon.weights = [0 0 0 1 -1 0 0.333333333333333 -0.333333333333333 0 0.333333333333333 -0.333333333333333 0 0.333333333333333 -0.333333333333333 0
% 0 0 0 0 1 -1 0 0.333333333333333 -0.333333333333333 0 0.333333333333333 -0.333333333333333 0 0.333333333333333 -0.333333333333333];
matlabbatch{1}.spm.stats.con.consess{2}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{3}.fcon.name = 'Interaction A*B (proper 3x3)';
matlabbatch{1}.spm.stats.con.consess{3}.fcon.weights = [1 -1 0 -1 1 0 0 0 0
0 1 -1 0 -1 1 0 0 0
0 0 0 1 -1 0 -1 1 0
0 0 0 0 1 -1 0 -1 1];
%matlabbatch{1}.spm.stats.con.consess{3}.fcon.weights = [0 0 0 0 0 0 1 -1 0 -1 1 0 0 0 0
% 0 0 0 0 0 0 0 1 -1 0 -1 1 0 0 0
% 0 0 0 0 0 0 0 0 0 1 -1 0 -1 1 0
% 0 0 0 0 0 0 0 0 0 0 1 -1 0 -1 1];
matlabbatch{1}.spm.stats.con.consess{3}.fcon.sessrep = 'none';
% Overall effect - you don't need to test this unless you are interested
%{
matlabbatch{1}.spm.stats.con.consess{4}.fcon.name = 'Overall effect (ie. Intercept??)';
matlabbatch{1}.spm.stats.con.consess{4}.fcon.weights = [1 1 1 1 1 1 1 1 1]; % not working for some reason
%matlabbatch{1}.spm.stats.con.consess{4}.fcon.weights = [1 1 1 1 1 1 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333 0.333333333333333];
matlabbatch{1}.spm.stats.con.consess{4}.fcon.sessrep = 'none';
%}
elseif strcmp(which_contrasts, '3x2') % using two 3x2 designs (i.e. testing sw$ & mix$ separately)
% For SWITCH effect:
matlabbatch{1}.spm.stats.con.consess{1}.fcon.name = 'SW - Main effect of Factor A (Context)';
matlabbatch{1}.spm.stats.con.consess{1}.fcon.weights = [0,1,1,0,-1,-1,0,0,0
0,0,0,0,1,1,0,-1,-1]; % we don't need to put in zeros(1,24) - SPM will autoly fill the 24 trailing cells with 0
matlabbatch{1}.spm.stats.con.consess{1}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{2}.fcon.name = 'SW - Main effect of Factor B (Ttype)';
matlabbatch{1}.spm.stats.con.consess{2}.fcon.weights = [0,1,-1,0,1,-1,0,1,-1];
matlabbatch{1}.spm.stats.con.consess{2}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{3}.fcon.name = 'SW - Interaction A*B (3x2)';
matlabbatch{1}.spm.stats.con.consess{3}.fcon.weights = [0,1,-1,0,-1,1,0,0,0
0,0,0,0,1,-1,0,-1,1];
matlabbatch{1}.spm.stats.con.consess{3}.fcon.sessrep = 'none';
% For MIXING effect:
matlabbatch{1}.spm.stats.con.consess{4}.fcon.name = 'MIX - Main effect of Factor A (Context)';
matlabbatch{1}.spm.stats.con.consess{4}.fcon.weights = [1,1,0,-1,-1,0,0,0,0
0,0,0,1,1,0,-1,-1,0]; % we don't need to put in zeros(1,24) - SPM will autoly fill the 24 trailing cells with 0
matlabbatch{1}.spm.stats.con.consess{4}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{5}.fcon.name = 'MIX - Main effect of Factor B (Ttype)';
matlabbatch{1}.spm.stats.con.consess{5}.fcon.weights = [1,-1,0,1,-1,0,1,-1,0];
matlabbatch{1}.spm.stats.con.consess{5}.fcon.sessrep = 'none';
matlabbatch{1}.spm.stats.con.consess{6}.fcon.name = 'MIX - Interaction A*B (3x2)';
matlabbatch{1}.spm.stats.con.consess{6}.fcon.weights = [1,-1,0,-1,1,0,0,0,0
0,0,0,1,-1,0,-1,1,0];
matlabbatch{1}.spm.stats.con.consess{6}.fcon.sessrep = 'none';
elseif strcmp(which_contrasts, 'bi_only')
% For SWITCH effect:
matlabbatch{1}.spm.stats.con.consess{1}.fcon.name = 'Switch cost';
matlabbatch{1}.spm.stats.con.consess{1}.fcon.weights = [0,0,0,0,0,0,0,1,-1]; % we don't need to put in zeros(1,24) - SPM will autoly fill the 24 trailing cells with 0
matlabbatch{1}.spm.stats.con.consess{1}.fcon.sessrep = 'none';
% For MIXING effect:
matlabbatch{1}.spm.stats.con.consess{2}.fcon.name = 'Mixing cost';
matlabbatch{1}.spm.stats.con.consess{2}.fcon.weights = [0,0,0,0,0,0,1,-1,0]; % we don't need to put in zeros(1,24) - SPM will autoly fill the 24 trailing cells with 0
matlabbatch{1}.spm.stats.con.consess{2}.fcon.sessrep = 'none';
end
matlabbatch{1}.spm.stats.con.delete = 0;