-
Notifications
You must be signed in to change notification settings - Fork 6
/
fearcloud_analyze_pmf600.m
142 lines (121 loc) · 4.19 KB
/
fearcloud_analyze_pmf600.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
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
%%%%%%%%%%600ms version analysis and plot script....
global project_path;project_path='C:\Users\onat\Google Drive\EthnoMaster\data\'
subjects=[40,42,44,45,46,47,48,49,51];
pmf=isn_getPMF(subjects,[1 5]);
n=length(subjects);
betaSD=10.^-pmf.beta;
%compute the means and stds
alpha.mean=mean(pmf.alpha);
alpha.std=std(pmf.alpha);
alpha.sem=alpha.std/sqrt(n);
beta.mean=mean(pmf.beta);
beta.std=std(pmf.beta);
beta.sem=beta.std/sqrt(n);
gamma.mean=mean(pmf.gamma);
lambda.mean=mean(pmf.lambda);
%%%%%%SCATTERPLOT 2x2
betaSD=10.^-(pmf.beta);
fig=figure('Position',[3 50 700 500]);
subplot(2,2,1)%CS+ alpha
plot(pmf.alpha(:,1,1),pmf.alpha(:,1,2),'go','MarkerFaceColor','g');
ylabel(sprintf('after'))
axis square
xlim([0 170])
ylim([0 170])
DrawIdentityLine(gca);
title('CS+ alpha')
box off
hold on;
plot(mean(pmf.alpha(:,1,1)),mean(pmf.alpha(:,1,2)),'k+','MarkerSize',10)
subplot(2,2,2)%CS+ beta
plot(betaSD(:,1,1),betaSD(:,1,2),'go','MarkerFaceColor','g');
title('CS+ beta')
axis square
xlim([0 100])
ylim([0 100])
DrawIdentityLine(gca);
box off
hold on;
plot(mean(betaSD(:,1,1)),mean(betaSD(:,1,2)),'k+','MarkerSize',10)
subplot(2,2,3)%CS- alpha
plot(pmf.alpha(:,2,1),pmf.alpha(:,2,2),'ko','MarkerFaceColor','y');
xlim([0 170])
ylim([0 170])
xlabel('before')
ylabel(sprintf('after'))
axis square
DrawIdentityLine(gca);
title('CS- alpha')
box off
hold on;
plot(mean(pmf.alpha(:,2,1)),mean(pmf.alpha(:,2,2)),'k+','MarkerSize',10)
subplot(2,2,4)%CS- beta
plot(betaSD(:,2,1),betaSD(:,2,2),'ko','MarkerFaceColor','y');
xlabel(sprintf('before'))
axis square
xlim([0 100])
ylim([0 100])
DrawIdentityLine(gca);
title('CS- beta')
box off
hold on;
plot(mean(betaSD(:,2,1)),mean(betaSD(:,2,2)),'k+','MarkerSize',10)
t=supertitle(['mean threshold \alpha and slope \beta, 600ms version, ' sprintf('N=%d',n)]);
set(t,'FontSize',14)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%barplot for means
%compute the mean
alpha.mean=mean(pmf.alpha);
alpha.std=std(pmf.alpha);
alpha.sem=alpha.std/sqrt(length(subjects));
beta.mean=mean(pmf.beta);
beta.std=std(pmf.beta);
beta.sem=beta.std/sqrt(length(subjects));
gamma.mean=mean(pmf.gamma);
lambda.mean=mean(pmf.lambda);
lower=10.^-(beta.mean+beta.sem);
upper=10.^-(beta.mean-beta.sem);
ubar=upper-(10.^-beta.mean);
lbar=10.^-beta.mean-lower;
beta.errorbars=NaN(2,2,2);
beta.errorbars(:,:,1)=squeeze(lbar);
beta.errorbars(:,:,2)=squeeze(ubar);
fig=figure('Position',[3 50 700 500]);
subplot(1,2,1)
[h,e] = barwitherr(squeeze(alpha.sem),squeeze(alpha.mean));
set(gca,'XTickLabel',{'CS+','CS-'})
set(e,'LineWidth',1.5)
set(h(1), 'FaceColor','r')
set(h(2), 'FaceColor',[143/255 0 0])
ylabel('threshold \alpha (degrees)')
axis square
legend('before','after','orientation','horizontal','location','southoutside')
subplot(1,2,2)
[h,e] = barwitherr(beta.errorbars,squeeze(10.^-mean(pmf.beta)));
set(gca,'XTickLabel',{'CS+','CS-'})
set(h(1), 'FaceColor','b')
set(h(2), 'FaceColor',[0 0.05 0.2])
set(e,'LineWidth',1.5)
legend('before','after','orientation','horizontal','location','southoutside')
ylabel('slope \beta (SD)')
ylim([0 80])
axis square
t=supertitle(['mean threshold \alpha and slope \beta, 600ms version, ' sprintf('N=%d',n)]);
set(t,'FontSize',14)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[p_csp_alpha,h,stats]=signtest(pmf.alpha(:,1,1),pmf.alpha(:,1,2))
[p_csn_alpha,h,stats]=signtest(pmf.alpha(:,2,1),pmf.alpha(:,2,2))
[p_csp_beta,h,stats]=signtest(pmf.beta(:,1,1),pmf.beta(:,1,2))
[p_csn_beta,h,stats]=signtest(pmf.beta(:,2,1),pmf.beta(:,2,2))
[p_csp_alpha,h]=signrank(pmf.alpha(:,1,1),pmf.alpha(:,1,2))
[p_csn_alpha,h]=signrank(pmf.alpha(:,2,1),pmf.alpha(:,2,2))
[p_csp_beta,h]=signrank(pmf.beta(:,1,1),pmf.beta(:,1,2))
[p_csn_beta,h]=signrank(pmf.beta(:,2,1),pmf.beta(:,2,2))
[h,p_csp_alpha]=ttest(pmf.alpha(:,1,1),pmf.alpha(:,1,2))
[h,p_csn_alpha]=ttest(pmf.alpha(:,2,1),pmf.alpha(:,2,2))
[h,p_csp_beta]=ttest(pmf.beta(:,1,1),pmf.beta(:,1,2))
[h,p_csp_beta]=ttest(pmf.beta(:,2,1),pmf.beta(:,2,2))
alph=[pmf.alpha(:,1,1),pmf.alpha(:,2,1);pmf.alpha(:,1,2),pmf.alpha(:,2,2)];
beta=[pmf.beta(:,1,1),pmf.beta(:,2,1);pmf.beta(:,1,2),pmf.beta(:,2,2)];
[p_a,table,stats]=anova2(alph,n);
[p_b,table,stats]=anova2(beta,n);