-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFancy.m
More file actions
210 lines (159 loc) · 7.62 KB
/
TestFancy.m
File metadata and controls
210 lines (159 loc) · 7.62 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
%% Simulate data, fit data to both models, run LL through the GBM see if recoers
clear IndVals
clear AtDVals
clear DtAVals
SetSize=[1,2,5];
AtDCorrectIdentTESTFANCY=zeros(17,2);
DtACorrectIdentTESTFANCY=zeros(17,2);
delays=[0,1,6];
nReps=50;
for N=3
for trials=1:100
for sub=1:17%[1,13,14,17] %these people only have 50 trials
if ismember(sub,[1,13,14,17])
nReps=50;% 50;
else
nReps=100; %100
end
PtsErr=totalResp{sub,2}(:,:,1);
for i=1:3
for j=1:3
AtD{i,j}=totalResp{sub,3}{i,j,2}';
end
end
if theSelectedPpl(2,sub)==1
params1=AtD5Param(sub,:);
[ PtsErrSIMAtD, AvgSIMAtD ] = GenIndAvgAtD(params1,SetSize(N),nReps,PtsErr(:,[1,N]),AtD(:,N));
%AtD refit
[ATDLLS5(sub,trials),~]=LL2vs5AtDMF(PtsErrSIMAtD,AvgSIMAtD(:,2,2),SetSize(N));
[DTALLS5(sub,trials),~]=LL2vs5DtAMF(PtsErrSIMAtD,AvgSIMAtD(:,2,2),SetSize(N));
if ATDLLS5(sub,trials)<DTALLS5(sub,trials)
TESTFANCY5(sub,trials)=1;
end
else
params2=DtA5Param(sub,:);
[ PtsErrSIMDtA, AvgSIMDtA ] = GenIndAvgDtA(params2,SetSize(N),nReps,PtsErr(:,[1,N]),AtD(:,N));
%DtA refit
[ATDLLS5(sub,trials),~]=LL2vs5AtDMF(PtsErrSIMDtA,AvgSIMDtA(:,2,2),SetSize(N));
[DTALLS5(sub,trials),~]=LL2vs5DtAMF(PtsErrSIMDtA,AvgSIMDtA(:,2,2),SetSize(N));
if DTALLS5(sub,trials)<ATDLLS5(sub,trials)
TESTFANCY5(sub,trials)=1;
end
end
% disp(sub);
end
disp(trials);
end
end
%%
options.verbose = false;
options.DisplayWin = false;
for i=1:100
[PosteriorVBA,outVBA] = VBA_groupBMC(-1*[ATDLLS(:,i)';DTALLS(:,i)'],options);
EpsAtD2(i)=outVBA.ep(1);
EpsDtA2(i)=outVBA.ep(2);
PercentAtD(i)=outVBA.Ef(1);
disp(i);
end
%%
figure(10)
subplot(1,3,2)
histogram(PercentAtD,[0:.1:1]);
hold on
histogram(PercentAtD(EpsAtD2>.95),[0:.1:1]);
plot([8/17,8/17],[0,40],'--k');
ylabel('Percent Simulations');
xlabel('Proportion AtD');
title({'Set Size 2: Simultaneous';'True 8 AtD: 9 DtA'})
% legend({'VBA Output', 'Ground Truth Proportion', 'AtD significantly more frequent'},'Location','Southeast');
set(gca,'Fontsize',14);
subplot(1,3,3)
histogram(PercentAtD2,[0:.1:1]);
hold on
histogram(PercentAtD2(EpsAtD>.95),[0:.1:1]);
plot([14/17,14/17],[0,70],'--k');
title({'Set Size 5: Simultaneous';'True 14 AtD: 3 DtA'})
ylabel('Percent Simulations');
xlabel('Proportion AtD');
legend({'VBA Proportion AtD', 'AtD significantly more frequent','Ground Truth Proportion', },'Location','Northwest');
set(gca,'Fontsize',14);
%% Sequential
SetSize=[1,2,5];
CorrectIdentSeq=zeros(17,100);
delays=[0,1,6];
nReps=100;
checkrangeseq=0;
for N=3
for trials=1:100
for sub=1:17
if ismember(sub,[1,6,13,14,17])
nReps=50;
else
nReps=100;
end
if N==2
params1=AtDParam2Seq(sub,:);
params2=DtAParam2Seq(sub,:);
else
params1=AtDParam5Seq(sub,:);
params2=DtAParam5Seq(sub,:);
end
for D=1:3
for nump=1:3
PtsErr{D,nump}=totalResp{sub,2}{D,nump,1}';
if D>1 && nump>1
AvgSeqPts{D,nump}=totalResp{sub,6}{D,nump,2}';
PtsErrEarlySeq{D,nump}=totalResp{sub,5}{D,nump,1}';
PtsErrLateSeq{D,nump}=totalResp{sub,8}{D,nump,1}';
end
end
end
%
if theSelectedPpl_seq(N-1,sub)==1
[ PtsErrSIMAtD, AvgSIMAtD, PtsErrSeqESimAtD, PtsErrSeqLSimAtD] = GenIndAvgAtDSeq(params1,SetSize(N), nReps, PtsErr(:,1), PtsErrEarlySeq(2:3,N),PtsErrLateSeq(2:3,N), AvgSeqPts(2:3,N) );
[AtDSeq(sub,trials),~]=LLAtDSeq_N_Freer(PtsErrSIMAtD,AvgSIMAtD(:,2,2),PtsErrSeqESimAtD(:,1),PtsErrSeqLSimAtD(:,1),SetSize(N));
[DtASeq(sub,trials),~]=LLDtASeq_N_Free(PtsErrSIMAtD,AvgSIMAtD(:,2,2),PtsErrSeqESimAtD(:,1),PtsErrSeqLSimAtD(:,1),SetSize(N));
if AtDSeq(sub,trials)<DtASeq(sub,trials)
CorrectIdentSeq(sub,trials)=1;
end
else
[ PtsErrSIMDtA, AvgSIMDtA, PtsErrSeqESimDtA, PtsErrSeqLSimDtA ] = GenIndAvgDtASeq(params2,SetSize(N), nReps, PtsErr(:,1), PtsErrEarlySeq(2:3,N),PtsErrLateSeq(2:3,N), AvgSeqPts(2:3,N));
%DtA refit
[AtDSeq(sub,trials),~]=LLAtDSeq_N_Freer(PtsErrSIMDtA,AvgSIMDtA(:,2,2),PtsErrSeqESimDtA(:,1),PtsErrSeqLSimDtA(:,1), SetSize(N));
[DtASeq(sub,trials),~]=LLDtASeq_N_Free(PtsErrSIMDtA,AvgSIMDtA(:,2,2),PtsErrSeqESimDtA(:,1),PtsErrSeqLSimDtA(:,1), SetSize(N));
if DtASeq(sub,trials)<AtDSeq(sub,trials)
CorrectIdentSeq(sub,trials)=1;
end
end
end
disp(trials)
end
end
%%
options.verbose = false;
options.DisplayWin = false;
for i=1:100
[PosteriorVBASeq,outVBASeq] = VBA_groupBMC(-1*[AtDSeq(:,i)';DtASeq(:,i)'],options);
EpsAtDSeq(i)=outVBASeq.ep(1);
EpsDtASeq(i)=outVBASeq.ep(2);
PercentAtDSeq(i)=outVBASeq.Ef(1);
disp(i);
end
%%
figure(10)
subplot(1,3,1)
histogram(PercentAtDSeq,[0:.1:1]);
hold on
histogram(PercentAtDSeq(EpsAtDSeq>.95),[0:.1:1]);
plot([9/17,9/17],[0,40],'--k');
ylabel('Percent Simulations');
xlabel('Proportion AtD');
title({'Set Size 2: Sequential';'True 9 AtD: 8 DtA'})
% legend({'VBA Output', 'Ground Truth Proportion', 'AtD significantly more frequent'},'Location','Southeast');
set(gca,'Fontsize',14);
%%
set(gcf,'Units','Inches');
set(gcf,'Position',[5.5833 7.6806 19.2639 5.8333])
pos = get(gcf,'Position');
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
% saveas(gcf,['FigRebuttle.pdf'])