-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrdm_neurom.m
90 lines (79 loc) · 2.01 KB
/
rdm_neurom.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
function [mods orthmods] = rdm_neurom(kap,off,gnorm);
%(c) Bernhard Spitzer, 2016
%% %%%%%%%%%%%%%%%%%%%% psychometric models %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f=[-1:0.4:1];
psym=abs((off+f).^kap).*sign(off+f);
if gnorm
g=sum(abs(f+off).^kap) / sum(abs(f));
psym=psym./g;
end
psym=[-psym;psym];
%% %%%%%%%%%%%%%%%%%%%% theoretical models %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% in here only for orthogonalization
%% digit
pc=ones(6,6);
for i=1:6
for j=1:6
if i==j % remove diagonal (6x6)
pc(i,j)=0;
end
end
end
c=[pc pc; pc pc];
mods.dig=c;
%% category
c=[zeros(6,6) ones(6,6); ones(6,6) zeros(6,6)];
for i=1:12
for j=1:12
if i==j % remove diagonal
c(i,j)=0;
end
end
end
mods.cat=c;
%% parity
v1=repmat([0 1],1,6);
v2=repmat([1 0],1,6);
c=repmat([v1;v2],6,1);
mods.eve=c;
%% %%%%%%%%%%%%%%%%%%%% behavioral models %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% signed weight (~ psychom numerical distance)
p=[-psym(1,:) psym(2,:)];
c=[];
for i=1:12
for j=1:12
c(i,j)=abs(p(i)-p(j));
end
end
squtest=squareform(c);
mods.numd=c;
%% response-mapped weight
p=[psym(1,:) psym(2,:)];
c=[];
for i=1:12
for j=1:12
c(i,j)=abs(p(i)-p(j));
end
end
squtest=squareform(c);
mods.nXc=c;
%% orthogonalize models
models=fieldnames(mods);
vecs=[];
for m=1:length(models)
vecs(:,m)=squareform(mods.(models{m}));
vecs(:,m)=vecs(:,m)-mean(vecs(:,m)); % mean center
end
for m=1:length(models) % recursive orthogonalization
order4orth=[find((1:length(models))~=m) m];
tmpvecs=spm_orth(vecs(:,order4orth));
orthmods.(models{m})=squareform(tmpvecs(:,end));
end
% %% plot model RDMs
% figure; colormap('hot');
% for m=1:length(models)
% subplot(2,length(models),m);
% imagesc(mods.(models{m}),[0 1]); title(models{m});
% subplot(2,length(models),m+length(models));
% imagesc(orthmods.(models{m}),[-1 1]); title([models{m} '_{orth}']);
% end