-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyzeAll.m
More file actions
210 lines (202 loc) · 8.02 KB
/
AnalyzeAll.m
File metadata and controls
210 lines (202 loc) · 8.02 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
function [] = AnalyzeAll()
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
% run individual analyses
load('data/subjdata.mat');
Nsubj = length(SubjNames);
for n = 1:Nsubj
AnalyzeSubj(n);
end
clear n;
% init
load('data/subjresults.mat');
% prepare ScoresVsSubjConf for plotting
minconf = 1;
maxconf = 5;
CI = .9;
for n = minconf:maxconf
popscores = PopScoreVsSubjConf(:,n);
popscores = popscores(~isnan(popscores)); % remove NaNs
PopScoreVsSubjConfAll(n) = mean(popscores);
[PopScoreVsSubjConfAllLEB(n),PopScoreVsSubjConfAllUEB(n)] = CIeb(popscores,CI);
areascores = AreaScoreVsSubjConf(:,n);
areascores = areascores(~isnan(areascores)); % remove NaNs
AreaScoreVsSubjConfAll(n) = mean(areascores);
[AreaScoreVsSubjConfAllLEB(n),AreaScoreVsSubjConfAllUEB(n)] = CIeb(areascores,CI);
end
clear n minconf maxconf popscores areascores CI;
% prepares ScoresVsObsConf for plotting
minconf = 1;
maxconf = 5;
CI = .9;
for n = minconf:maxconf
popscores = PopScoreVsObsConf(:,n);
popscores = popscores(~isnan(popscores)); % remove NaNs
PopScoreVsObsConfAll(n) = mean(popscores);
[PopScoreVsObsConfAllLEB(n),PopScoreVsObsConfAllUEB(n)] = CIeb(popscores,CI);
areascores = AreaScoreVsObsConf(:,n);
areascores = areascores(~isnan(areascores)); % remove NaNs
AreaScoreVsObsConfAll(n) = mean(areascores);
[AreaScoreVsObsConfAllLEB(n),AreaScoreVsObsConfAllUEB(n)] = CIeb(areascores,CI);
end
clear n minconf maxconf popscores areascores;
% calculate correlations...
Nsubj = length(SubjNames);
Nquiz = 2;
Npair = 26;
subjconfs = zeros(Nsubj,Nquiz,Npair);
obsconfs = zeros(Nsubj,Nquiz,Npair);
subjdelays = zeros(Nsubj,Nquiz,Npair);
scores = zeros(Nsubj,Nquiz,Npair);
for n = 1:Nsubj
subjconfs(n,1,:) = PopConf(n,PopQOrder(n,:));
subjconfs(n,2,:) = AreaConf(n,AreaQOrder(n,:));
obsconfs(n,1,:) = ObsPopConf(n,:);
obsconfs(n,2,:) = ObsAreaConf(n,:);
subjdelays(n,1,:) = PopDelay(n,PopQOrder(n,:));
subjdelays(n,2,:) = AreaDelay(n,AreaQOrder(n,:));
scores(n,1,:) = PopMark(n,PopQOrder(n,:));
scores(n,2,:) = AreaMark(n,AreaQOrder(n,:));
end
clear n;
% ...between subj/obs confidence estimates
[SubjVsObsConfPCorrAll,SubjVsObsConfPCorrAllPV] =...
corr(subjconfs(:),obsconfs(:),'type','Pearson');
[SubjVsObsConfKCorrAll,SubjVsObsConfKCorrAllPV] =...
corr(subjconfs(:),obsconfs(:),'type','Kendall');
[SubjVsObsConfSCorrAll,SubjVsObsConfSCorrAllPV] =...
corr(subjconfs(:),obsconfs(:),'type','Spearman');
%...between subj delay and obs confidence estimate
[ObsConfVsSubjDelayPCorrAll,ObsConfVsSubjDelayPCorrAllPV] =...
corr(subjdelays(:),obsconfs(:),'type','Pearson');
[ObsConfVsSubjDelayKCorrAll,ObsConfVsSubjDelayKCorrAllPV] =...
corr(subjdelays(:),obsconfs(:),'type','Kendall');
[ObsConfVsSubjDelaySCorrAll,ObsConfVsSubjDelaySCorrAllPV] =...
corr(subjdelays(:),obsconfs(:),'type','Spearman');
%...between subj delay and subj confidence
[SubjConfVsDelayPCorrAll,SubjConfVsDelayPCorrAllPV] =...
corr(subjdelays(:),subjconfs(:),'type','Pearson');
[SubjConfVsDelayKCorrAll,SubjConfVsDelayKCorrAllPV] =...
corr(subjdelays(:),subjconfs(:),'type','Kendall');
[SubjConfVsDelaySCorrAll,SubjConfVsDelaySCorrAllPV] =...
corr(subjdelays(:),subjconfs(:),'type','Spearman');
%...between subj conf and scores
[SubjConfVsScorePCorrAll,SubjConfVsScorePCorrAllPV] =...
corr(subjconfs(:),scores(:),'type','Pearson');
[SubjConfVsScoreKCorrAll,SubjConfVsScoreKCorrAllPV] =...
corr(subjconfs(:),scores(:),'type','Kendall');
[SubjConfVsScoreSCorrAll,SubjConfVsScoreSCorrAllPV] =...
corr(subjconfs(:),scores(:),'type','Spearman');
%...between obs conf and scores
[ObsConfVsScorePCorrAll,ObsConfVsScorePCorrAllPV] =...
corr(obsconfs(:),scores(:),'type','Pearson');
[ObsConfVsScoreKCorrAll,ObsConfVsScoreKCorrAllPV] =...
corr(obsconfs(:),scores(:),'type','Kendall');
[ObsConfVsScoreSCorrAll,ObsConfVsScoreSCorrAllPV] =...
corr(obsconfs(:),scores(:),'type','Spearman');
%...between subj delay and scores
[DelayVsScorePCorrAll,DelayVsScorePCorrAllPV] =...
corr(subjdelays(:),scores(:),'type','Pearson');
[DelayVsScoreKCorrAll,DelayVsScoreKCorrAllPV] =...
corr(subjdelays(:),scores(:),'type','Kendall');
[DelayVsScoreSCorrAll,DelayVsScoreSCorrAllPV] =...
corr(subjdelays(:),scores(:),'type','Spearman');
% are people who are good at predicting their own confidence also good at predicting others'...?
% ...confidence in an absolute sense
[SelfPredVsConfPredPCorr,SelfPredVsConfPredPCorrPV] =...
corr(SubjConfVsScorePCorr(1:end-1)',SubjVsObsConfPCorr(2:end)','type','Pearson');
[SelfPredVsConfPredKCorr,SelfPredVsConfPredKCorrPV] =...
corr(SubjConfVsScoreKCorr(1:end-1)',SubjVsObsConfKCorr(2:end)','type','Kendall');
[SelfPredVsConfPredSCorr,SelfPredVsConfPredSCorrPV] =...
corr(SubjConfVsScoreSCorr(1:end-1)',SubjVsObsConfSCorr(2:end)','type','Spearman');
% ...performance in an absolute sense
[SelfPredVsScorePredAbsPCorr,SelfPredVsScorePredAbsPCorrPV] =...
corr(SubjConfVsScorePCorr(1:end-1)',ObsConfVsScorePCorr(2:end)','type','Pearson');
[SelfPredVsScorePredAbsKCorr,SelfPredVsScorePredAbsKCorrPV] =...
corr(SubjConfVsScoreKCorr(1:end-1)',ObsConfVsScoreKCorr(2:end)','type','Kendall');
[SelfPredVsScorePredAbsSCorr,SelfPredVsScorePredAbsSCorrPV] =...
corr(SubjConfVsScoreSCorr(1:end-1)',ObsConfVsScoreSCorr(2:end)','type','Spearman');
% ...performance relative to the other's prediction of self
[SelfPredVsScorePredRelPCorr,SelfPredVsScorePredRelPCorrPV] =...
corr(...
SubjConfVsScorePCorr(1:end-1)',...
(ObsConfVsScorePCorr(2:end)-SubjConfVsScorePCorr(2:end))','type','Pearson');
[SelfPredVsScorePredRelKCorr,SelfPredVsScorePredRelKCorrPV] =...
corr(...
SubjConfVsScoreKCorr(1:end-1)',...
(ObsConfVsScoreKCorr(2:end)-SubjConfVsScorePCorr(2:end))','type','Kendall');
[SelfPredVsScorePredRelSCorr,SelfPredVsScorePredRelSCorrPV] =...
corr(...
SubjConfVsScoreSCorr(1:end-1)',...
(ObsConfVsScoreSCorr(2:end)-SubjConfVsScorePCorr(2:end))','type','Spearman');
% save
save(...
'data/subjresults.mat',...
'PopScoreVsSubjConfAll',...
'PopScoreVsSubjConfAllLEB',...
'PopScoreVsSubjConfAllUEB',...
'AreaScoreVsSubjConfAll',...
'AreaScoreVsSubjConfAllLEB',...
'AreaScoreVsSubjConfAllUEB',...
'PopScoreVsObsConfAll',...
'PopScoreVsObsConfAllLEB',...
'PopScoreVsObsConfAllUEB',...
'AreaScoreVsObsConfAll',...
'AreaScoreVsObsConfAllLEB',...
'AreaScoreVsObsConfAllUEB',...
'SubjVsObsConfPCorrAll',...
'SubjVsObsConfPCorrAllPV',...
'SubjVsObsConfKCorrAll',...
'SubjVsObsConfKCorrAllPV',...
'SubjVsObsConfSCorrAll',...
'SubjVsObsConfSCorrAllPV',...
'ObsConfVsSubjDelayPCorrAll',...
'ObsConfVsSubjDelayPCorrAllPV',...
'ObsConfVsSubjDelayKCorrAll',...
'ObsConfVsSubjDelayKCorrAllPV',...
'ObsConfVsSubjDelaySCorrAll',...
'ObsConfVsSubjDelaySCorrAllPV',...
'SubjConfVsDelayPCorrAll',...
'SubjConfVsDelayPCorrAllPV',...
'SubjConfVsDelayKCorrAll',...
'SubjConfVsDelayKCorrAllPV',...
'SubjConfVsDelaySCorrAll',...
'SubjConfVsDelaySCorrAllPV',...
'SubjConfVsScorePCorrAll',...
'SubjConfVsScorePCorrAllPV',...
'SubjConfVsScoreKCorrAll',...
'SubjConfVsScoreKCorrAllPV',...
'SubjConfVsScoreSCorrAll',...
'SubjConfVsScoreSCorrAllPV',...
'ObsConfVsScorePCorrAll',...
'ObsConfVsScorePCorrAllPV',...
'ObsConfVsScoreKCorrAll',...
'ObsConfVsScoreKCorrAllPV',...
'ObsConfVsScoreSCorrAll',...
'ObsConfVsScoreSCorrAllPV',...
'DelayVsScorePCorrAll',...
'DelayVsScorePCorrAllPV',...
'DelayVsScoreKCorrAll',...
'DelayVsScoreKCorrAllPV',...
'DelayVsScoreSCorrAll',...
'DelayVsScoreSCorrAllPV',...
'SelfPredVsConfPredPCorr',...
'SelfPredVsConfPredPCorrPV',...
'SelfPredVsConfPredKCorr',...
'SelfPredVsConfPredKCorrPV',...
'SelfPredVsConfPredSCorr',...
'SelfPredVsConfPredSCorrPV',...
'SelfPredVsScorePredAbsPCorr',...
'SelfPredVsScorePredAbsPCorrPV',...
'SelfPredVsScorePredAbsKCorr',...
'SelfPredVsScorePredAbsKCorrPV',...
'SelfPredVsScorePredAbsSCorr',...
'SelfPredVsScorePredAbsSCorrPV',...
'SelfPredVsScorePredRelPCorr',...
'SelfPredVsScorePredRelPCorrPV',...
'SelfPredVsScorePredRelKCorr',...
'SelfPredVsScorePredRelKCorrPV',...
'SelfPredVsScorePredRelSCorr',...
'SelfPredVsScorePredRelSCorrPV',...
'-append');
end