123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- close all;
- clear;
- % boxplots for context effect index
- load('all_ce.mat')
- aw_=all_ce(:,1)==1; n_aw=sum(aw_);
- an_=all_ce(:,1)==2; n_an=sum(an_);
- chi_=all_ce(:,1)==3; n_chi=sum(chi_);
- nav=all_ce(:,2:3);
- com=all_ce(:,4:5);
- % comparisons
- y1=nan(117,4);
- y2=nan(117,4);
- y1(1:n_aw,1:2)=nav(aw_,:);
- y1(1:n_an,3:4)=nav(an_,:);
- y2(1:n_aw,1:2)=com(aw_,:);
- y2(1:n_an,3:4)=com(an_,:);
- y3=[(y1(:,2)-y1(:,1))./2,(y2(:,2)-y2(:,1))./2,(y1(:,4)-y1(:,3))./2,(y2(:,4)-y2(:,3))./2] ;
- %% plotting
- red =[0.8500,0.3250, 0.0980];
- blue=[0,0.4470,0.7410];
- red_light=[1,0.5,0.5].*red;
- blue_light=[1,0.5,0.5].*blue;
- colors=[blue;blue_light;red;red_light];
- wid=160;
- hei=180;
- x = 1:4;
- figure(1); set(gcf,'Position',[400 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y1(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
- plot(3:4,nanmedian(y1(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
- hold off
- xlim([0.5 4.5])
- ylabel('echolocation effect')
- xticklabels({'match','mismatch','match','mismatch'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- %% add stats
- pv1=signrank(y1(:,1),y1(:,2));
- pv2=signrank(y1(:,3),y1(:,4));
- pv3=ranksum(y1(:,1),y1(:,3));
- pv4=ranksum(y1(:,2),y1(:,4));
- xt = get(gca, 'XTick');
- line1=0.45;
- line2=0.65;
- line3=0.85;
- sl=0.75;
- % plot lines for comparison
- hold on
- plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
- plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
- ylim([-1 1])
- % plot level of significance
- if pv1 <= 0.05 && pv1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pv1 <=0.01 && pv1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pv1 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- if pv2 <= 0.05 && pv2 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pv2 <=0.01 && pv2 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pv2 <= 0.001
- text(mean(xt(3:4))-0.15, line1+0.05, '***')
- else
- text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- if pv3 <= 0.05 && pv3 > 0.01
- text(mean(xt(1:3))-0.025, line2+0.05, '*')
- elseif pv3 <=0.01 && pv3 > 0.001
- text(mean(xt(1:3))-0.05, line2+0.05, '**')
- elseif pv3 <= 0.001
- text(mean(xt(1:3))-0.15, line2+0.05, '***')
- else
- text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',8)
- end
- if pv4 <= 0.05 && pv4 > 0.01
- text(mean(xt(2:4))-0.025, line3+0.05, '*')
- elseif pv4 <=0.01 && pv4 > 0.001
- text(mean(xt(2:4))-0.05, line3+0.05, '**')
- elseif pv4 <= 0.001
- text(mean(xt(2:4))-0.15, line3+0.05, '***')
- else
- text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',8)
- end
- %% plotting number 2
- figure(2); set(gcf,'Position',[400 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y2(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
- plot(3:4,nanmedian(y2(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
- hold off
- xlim([0.5 4.5])
- ylabel('communication effect')
- xticklabels({'match','mismatch','match','mismatch'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- %% add stats
- pv1=signrank(y2(:,1),y2(:,2));
- pv2=signrank(y2(:,3),y2(:,4));
- pv3=ranksum(y2(:,1),y2(:,3));
- pv4=ranksum(y2(:,2),y2(:,4));
- xt = get(gca, 'XTick');
- % plot lines for comparison
- hold on
- plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
- plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
- ylim([-1 1])
- % plot level of significance
- if pv1 <= 0.05 && pv1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pv1 <=0.01 && pv1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pv1 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- if pv2 <= 0.05 && pv2 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pv2 <=0.01 && pv2 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pv2 <= 0.001
- text(mean(xt(3:4))-0.15, line1+0.05, '***')
- else
- text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- if pv3 <= 0.05 && pv3 > 0.01
- text(mean(xt(1:3))-0.025, line2+0.05, '*')
- elseif pv3 <=0.01 && pv3 > 0.001
- text(mean(xt(1:3))-0.05, line2+0.05, '**')
- elseif pv3 <= 0.001
- text(mean(xt(1:3))-0.15, line2+0.05, '***')
- else
- text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',8)
- end
- if pv4 <= 0.05 && pv4 > 0.01
- text(mean(xt(2:4))-0.025, line3+0.05, '*')
- elseif pv4 <=0.01 && pv4 > 0.001
- text(mean(xt(2:4))-0.05, line3+0.05, '**')
- elseif pv4 <= 0.001
- text(mean(xt(2:4))-0.15, line3+0.05, '***')
- else
- text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',8)
- end
- %% plotting number 3
- figure(3); set(gcf,'Position',[400 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y3(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
- plot(3:4,nanmedian(y3(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
- hold off
- xlim([0.5 4.5])
- ylabel('s.s.s.')
- xticklabels({'ech','com','ech','com'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- %% add stats
- pv1=signrank(y3(:,1),y3(:,2));
- pv2=signrank(y3(:,3),y3(:,4));
- pv3=ranksum(y3(:,1),y3(:,3));
- pv4=ranksum(y3(:,2),y3(:,4));
- pv5=signrank(y3(:,1));
- pv6=signrank(y3(:,2));
- pv7=signrank(y3(:,3));
- pv8=signrank(y3(:,4));
- xt = get(gca, 'XTick');
- % plot lines for comparison
- line1=0.45;
- hold on
- plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line1,line1-0.03],'-k', 'LineWidth',sl);
- plot([1;1]*xt(2),[line1,line1-0.03],'-k', 'LineWidth',sl);
- plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(3),[line1,line1-0.03],'-k', 'LineWidth',sl);
- plot([1;1]*xt(4),[line1,line1-0.03],'-k', 'LineWidth',sl);
- ylim([-0.5 0.55])
- % plot level of significance
- if pv1 <= 0.05 && pv1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pv1 <=0.01 && pv1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pv1 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- if pv2 <= 0.05 && pv2 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pv2 <=0.01 && pv2 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pv2 <= 0.001
- text(mean(xt(3:4))-0.15, line1+0.05, '***')
- else
- text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
- end
- % add stats against null distribution
- line0=-0.45;
- if pv5 <= 0.05 && pv5 > 0.01
- text(xt(1), line0, '*','HorizontalAlignment','center')
- elseif pv5 <=0.01 && pv5 > 0.001
- text(xt(1), line0, '**','HorizontalAlignment','center')
- elseif pv5 <= 0.001
- text(xt(1), line0, '***','HorizontalAlignment','center')
- else
- text(xt(1), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
- end
- if pv6 <= 0.05 && pv6 > 0.01
- text(xt(2), line0, '*','HorizontalAlignment','center')
- elseif pv6 <=0.01 && pv6 > 0.001
- text(xt(2), line0, '**','HorizontalAlignment','center')
- elseif pv6 <= 0.001
- text(xt(2), line0, '***','HorizontalAlignment','center')
- else
- text(xt(2), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
- end
- if pv7 <= 0.07 && pv7 > 0.01
- text(xt(3), line0, '*','HorizontalAlignment','center')
- elseif pv7 <=0.01 && pv7 > 0.001
- text(xt(3), line0, '**','HorizontalAlignment','center')
- elseif pv7 <= 0.001
- text(xt(3), line0, '***','HorizontalAlignment','center')
- else
- text(xt(3), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
- end
- if pv8 <= 0.05 && pv8 > 0.01
- text(xt(4), line0, '*','HorizontalAlignment','center')
- elseif pv8 <=0.01 && pv8 > 0.001
- text(xt(4), line0, '**','HorizontalAlignment','center')
- elseif pv8 <= 0.001
- text(xt(4), line0, '***','HorizontalAlignment','center')
- else
- text(xt(4), line0+0.03, 'ns','FontSize',8,'HorizontalAlignment','center')
- end
- % l=yline(0,'Color',[0.6 0.6 0.6], 'LineWidth',2);
- % uistack(l,'bottom')
|