123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 |
- clear;
- close all;
- % paired analysis per unit tested in different protocols
- load('pt_data.mat')
- c_=all_di(:,2)==0; % unit classification
- int_=all_di(:,3)==1; % intact: 1
- comp_=all_di(:,3)==2; % chimeras: 2 pure tones: 3
- particular=logical(c_.*int_);
- particular2=logical(c_.*comp_);
- % respective discriminability index
- di_iso=all_di(particular,4);
- di_nav=all_di(particular,5);
- di_com=all_di(particular,6);
- di_nav_comp=all_di(particular2,5);
- di_com_comp=all_di(particular2,6);
- y1=[di_nav,di_iso,di_nav_comp];
- y2=[di_com,di_iso,di_com_comp];
- % respective context effect index
- ce_nav_exp=all_di(particular,7);
- ce_nav_unexp=all_di(particular,8);
- ce_com_exp=all_di(particular,9);
- ce_com_unexp=all_di(particular,10);
- ce_nav_exp_comp=all_di(particular2,7);
- ce_nav_unexp_comp=all_di(particular2,8);
- ce_com_exp_comp=all_di(particular2,9);
- ce_com_unexp_comp=all_di(particular2,10);
- y3=[ce_nav_exp,ce_nav_exp_comp,ce_nav_unexp,ce_nav_unexp_comp];
- y4=[ce_com_exp,ce_com_exp_comp,ce_com_unexp,ce_com_unexp_comp];
- % respective deviance detection index
- dd_nav=ce_nav_unexp-ce_nav_exp;
- dd_com=ce_com_unexp-ce_com_exp;
- dd_nav_comp=ce_nav_unexp_comp-ce_nav_exp_comp;
- dd_com_comp=ce_com_unexp_comp-ce_com_exp_comp;
- y5=[dd_nav,dd_nav_comp,dd_com,dd_com_comp];
- % compare paired samples discriminability index
- pvA1=signrank(di_iso,di_nav);
- pvA2=signrank(di_iso,di_nav_comp);
- pvA3=signrank(di_iso,di_com);
- pvA4=signrank(di_iso,di_com_comp);
- % compare paired samples context effect index
- pvB1=signrank(ce_nav_exp,ce_nav_exp_comp);
- pvB2=signrank(ce_nav_unexp,ce_nav_unexp_comp);
- pvB3=signrank(ce_nav_exp,ce_nav_unexp);
- pvB4=signrank(ce_nav_exp_comp,ce_nav_unexp_comp);
- pvB5=signrank(ce_com_exp,ce_com_exp_comp);
- pvB6=signrank(ce_com_unexp,ce_com_unexp_comp);
- pvB7=signrank(ce_com_exp,ce_com_unexp);
- pvB8=signrank(ce_com_exp_comp,ce_com_unexp_comp);
- % compare paired samples discriminability index
- pvC1=signrank(dd_nav,dd_nav_comp);
- pvC2=signrank(dd_com,dd_com_comp);
- %% plot d.i. in isolation and after two different context
- 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;
- black=[0.2 0.2 0.2];
- green_light=[0.4863,0.3059,0.7098]; %green: [0.3922,0.8314,0.0745];
- green=[0.2980,0.1294,0.5098]; %[0.4667,0.6745,0.1882];
- lines_color=[0.7 0.7 0.7]; % light gray
- bar_colors=[blue; black; red];
- x = 1:3;
- figure(1); set(gcf,'Position',[400 200 200 250])
- ax = axes();
- hold(ax);
- for i=1:3
- h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=bar_colors(i,:);
- end
- % add lines per unit
- hold on
- for i=1:numel(di_iso)
- l=plot([1,2], [di_nav(i), di_iso(i)],'color',lines_color);
- uistack(l,'bottom')
- l=plot([2,3], [di_iso(i), di_nav_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- end
- hold off
- xlim([0.5 3.5])
- ylabel('discriminability index')
- xticklabels({'intact','silence','chimera'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- xt = get(gca, 'XTick');
- line1=0.5;
- line2=0.7;
- 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(2:3), [1 1]*line2, '-k','LineWidth',sl)
- plot([1;1]*xt(2),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
- ylim([-1 1])
- % plot level of significance
- if pvA1 <= 0.05 && pvA1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pvA1 <=0.01 && pvA1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pvA1 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
- end
- if pvA2 <= 0.05 && pvA2 > 0.01
- text(mean(xt(2:3))-0.025, line2+0.05, '*')
- elseif pvA2 <=0.01 && pvA2 > 0.001
- text(mean(xt(2:3))-0.05, line2+0.05, '**')
- elseif pvA2 <= 0.001
- text(mean(xt(2:2))-0.15, line2+0.05, '***')
- else
- text(mean(xt(2:3))-0.05, line2+0.075, 'ns','FontSize',8)
- end
- bar_colors=[blue; black; red];
- lines_color=[0.7 0.7 0.7]; % light gray
- x = 1:3;
- figure(2); set(gcf,'Position',[600 200 200 250])
- ax = axes();
- hold(ax);
- for i=1:3
- h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=bar_colors(i,:);
- end
- % add lines per unit
- hold on
- for i=1:numel(di_iso)
- l=plot([1,2], [di_com(i), di_iso(i)],'color',lines_color);
- uistack(l,'bottom')
- l=plot([2,3], [di_iso(i), di_com_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- end
- hold off
- xlim([0.5 3.5])
- ylabel('discriminability index')
- xticklabels({'intact','silence','chimera'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- xt = get(gca, 'XTick');
- line1=0.5;
- line2=0.7;
- 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(2:3), [1 1]*line2, '-k','LineWidth',sl)
- plot([1;1]*xt(2),[line2,line2-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
- ylim([-1 1])
- % plot level of significance
- if pvA3 <= 0.05 && pvA3 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pvA3 <=0.01 && pvA3 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pvA3 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
- end
- if pvA4 <= 0.05 && pvA4 > 0.01
- text(mean(xt(2:3))-0.025, line2+0.05, '*')
- elseif pvA4 <=0.01 && pvA4 > 0.001
- text(mean(xt(2:3))-0.05, line2+0.05, '**')
- elseif pvA4 <= 0.001
- text(mean(xt(2:2))-0.15, line2+0.05, '***')
- else
- text(mean(xt(2:3))-0.05, line2+0.075, 'ns','FontSize',8)
- end
- %% plot c.e. for expected and unexpected probes after two different context
- bar_colors=[red;green_light;red_light;green];
- x = 1:4;
- figure(3); set(gcf,'Position',[400 200 160 180])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=bar_colors(i,:);
- end
- % add lines per unit
- hold on
- for i=1:numel(ce_nav_exp)
- l=plot([1,2], [ce_nav_exp(i), ce_nav_exp_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- l=plot([3,4], [ce_nav_unexp(i), ce_nav_unexp_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- end
- hold off
- xlim([0.5 4.5])
- ylabel('echolocation effect')
- xticklabels({'match','match-fast','mismatch','mismatch-fast'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- 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.05 1])
- % plot level of significance
- if pvB1 <= 0.05 && pvB1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pvB1 <=0.01 && pvB1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pvB1 <= 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',7)
- end
- if pvB2 <= 0.05 && pvB2 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pvB2 <=0.01 && pvB2 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pvB2 <= 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',7)
- end
- if pvB3 <= 0.05 && pvB3 > 0.01
- text(mean(xt(1:3))-0.025, line2+0.05, '*')
- elseif pvB3 <=0.01 && pvB3 > 0.001
- text(mean(xt(1:3))-0.05, line2+0.05, '**')
- elseif pvB3 <= 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',7)
- end
- if pvB4 <= 0.05 && pvB4 > 0.01
- text(mean(xt(2:4))-0.025, line3+0.05, '*')
- elseif pvB4 <=0.01 && pvB4 > 0.001
- text(mean(xt(2:4))-0.05, line3+0.05, '**')
- elseif pvB4 <= 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',7)
- end
- exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_chi_nav.pdf',...
- 'Resolution',300','ContentType','vector','BackgroundColor','none')
- figure(4); set(gcf,'Position',[400 200 160 180])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y4(:,i))), y4(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=bar_colors(i,:);
- end
- % add lines per unit
- hold on
- for i=1:numel(ce_nav_exp)
- l=plot([1,2], [ce_com_exp(i), ce_com_exp_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- l=plot([3,4], [ce_com_unexp(i), ce_com_unexp_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- end
- hold off
- xlim([0.5 4.5])
- ylim([-1.05, 0.4])
- ylabel('communication effect')
- xticklabels({'match','match-slow','mismatch','mismatch-slow'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- 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.05 1])
- % plot level of significance
- if pvB5 <= 0.05 && pvB5 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pvB5 <=0.01 && pvB5 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pvB5 <= 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',7)
- end
- if pvB6 <= 0.05 && pvB6 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pvB6 <=0.01 && pvB6 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pvB6 <= 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',7)
- end
- if pvB7 <= 0.05 && pvB7 > 0.01
- text(mean(xt(1:3))-0.025, line2+0.05, '*')
- elseif pvB7 <=0.01 && pvB7 > 0.001
- text(mean(xt(1:3))-0.05, line2+0.05, '**')
- elseif pvB7 <= 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',7)
- end
- if pvB8 <= 0.05 && pvB8 > 0.01
- text(mean(xt(2:4))-0.025, line3+0.05, '*')
- elseif pvB8 <=0.01 && pvB8 > 0.001
- text(mean(xt(2:4))-0.05, line3+0.05, '**')
- elseif pvB8 <= 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',7)
- end
- exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_chi_com.pdf',...
- 'Resolution',300','ContentType','vector','BackgroundColor','none')
- %% plot d.d. for different context after two different context
- bar_colors=[red_light;red;blue_light;blue];
- x = 1:4;
- figure(5); set(gcf,'Position',[400 200 250 250])
- ax = axes();
- hold(ax);
- for i=1:4
- h=boxchart(x(i)*ones(size(y5(:,i))), y5(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=bar_colors(i,:);
- end
- % add lines per unit
- hold on
- for i=1:numel(dd_nav)
- l=plot([1,2], [dd_nav(i), dd_nav_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- l=plot([3,4], [dd_com(i), dd_com_comp(i)],'color',lines_color);
- uistack(l,'bottom')
- end
- hold off
- xlim([0.5 4.5])
- ylabel('deviance detection')
- xticklabels({'intact','chimera','intact','chimera'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- xt = get(gca, 'XTick');
- line1=0.75;
- 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);
- ylim([-0.75 1])
- % plot level of significance
- if pvC1 <= 0.05 && pvC1 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.05, '*')
- elseif pvC1 <=0.01 && pvC1 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.05, '**')
- elseif pvC1 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.05, '***')
- else
- text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
- end
- if pvC2 <= 0.05 && pvC2 > 0.01
- text(mean(xt(3:4))-0.025, line1+0.05, '*')
- elseif pvC2 <=0.01 && pvC2 > 0.001
- text(mean(xt(3:4))-0.05, line1+0.05, '**')
- elseif pvC2 <= 0.001
- text(mean(xt(3:4))-0.15, line1+0.05, '***')
- else
- text(mean(xt(3:4))-0.05, line1+0.075, 'ns','FontSize',8)
- end
|