File size: 33,827 Bytes
b0cc889 |
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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
%% Step 3 - View ERPs
clear all; clc
addpath('Z:\EXPERIMENTS\Flankers t2t\');
datalocation='Y:\EEG_Data\Flankers OCDII\ERPs\'; % Data are here
cd(datalocation);
load('Z:\EXPERIMENTS\Flankers t2t\NScan_Chanlocs_60.mat');
FILZ=dir('*_ERPs_2018_Revision_withErrors.mat');
sidx=1;
for si=1:length(FILZ)
load(FILZ(si).name);
load(['Y:\EEG_Data\Flankers OCDII\Processed Data\',num2str(FILZ(si).name(1:3)),'_BEH_VECTOR.mat'],'BEH_VECTOR');
if SUBJINFO(6)<=21
MEGA_ERP(sidx,:,:,:)=ERP;
MEGA_ERP_RESP(sidx,:,:)=ERP_RESP;
MEGA_ERP_RESP_All(sidx,:,:,:)=ERP_RESP_All;
MEGA_SUBJINFO(sidx,:)=SUBJINFO;
BEH{sidx}=VECTOR;
BEH_WithErrors{sidx}=BEH_VECTOR;
for tfi=1:2
MEGA_PWR{tfi}(sidx,:,:,:)=POWER{tfi};
MEGA_PHS{tfi}(sidx,:,:,:)=ITPC{tfi};
end
% From revision
MEGA_ERP_minsize(sidx,:,:,:)=ERP_minsize; % Same as ERPs, but limited to min trial ct size
MEGA_ERP_LRP_minsize(sidx,:,:,:)=ERP_LRP_minsize; % Same as ERP LRPs, but limited to min trial ct size
% ^^^^^^^^
MEGA_ERP_LRP_to_STIM(sidx,:,:)=ERP_LRP_to_STIM; % Same as LRP, but stim-locked
% ^^^^^^^^
MEGA_ERP_Corr(sidx,:,:,:)=ERP_Corr; % single trial RT corr
MEGA_ERP_RESP_Corr(sidx,:,:)=ERP_RESP_Corr; % single trial RT corr - LRP
sidx=sidx+1;
end
clear SUBJINFO SUBJINFO_HDR VECTOR BEH_VECTOR POWER ITPC ERP_RESP_All BEH_VECTOR;
clear ERP_LRP_to_STIM ERP_minsize ERP_Corr ERP_RESP_Corr
end
%% ACCURACY
for si=1:23
VECTOR=BEH_WithErrors{si};
VECTOR(VECTOR(:,7)==1,[3,6])=NaN; % No blockstarts
VECTOR(VECTOR(:,5)<200,[3,6])=NaN; % If RT<200 or NaN, then NaN the row
VECTOR(isnan(VECTOR(:,5)),[3,6])=NaN;
VECTOR(:,9)=[99;VECTOR(1:end-1,3)]; % prev congru
VECTOR(:,10)=[99;VECTOR(1:end-1,4)]; % prev RightLeft
for ai=1:length(VECTOR)
if ~isnan(VECTOR(ai,3))
GRATTON=NaN; RESPS=NaN;
% ---------------------- congruent (1) or conflict (0)
if VECTOR(ai,9)==1 && VECTOR(ai,3)==1, GRATTON=1; % cC
elseif VECTOR(ai,9)==1 && VECTOR(ai,3)==0, GRATTON=2; % cI
elseif VECTOR(ai,9)==0 && VECTOR(ai,3)==1, GRATTON=3; % iC
elseif VECTOR(ai,9)==0 && VECTOR(ai,3)==0, GRATTON=4; % iI
end
% ---------------------- [Right=1, Left=2]
if VECTOR(ai,10)==1 && VECTOR(ai,4)==1, RESPS=1; % rR
elseif VECTOR(ai,10)==2 && VECTOR(ai,4)==2, RESPS=1; % lL
elseif VECTOR(ai,10)==1 && VECTOR(ai,4)==2, RESPS=10; % rL
elseif VECTOR(ai,10)==2 && VECTOR(ai,4)==1, RESPS=10; % lR
end
% ----------------------
VECTOR(ai,14)=GRATTON;
VECTOR(ai,15)=RESPS;
VECTOR(ai,16)=GRATTON.*RESPS;
clear GRATTON RESPS
else
% ----------------------
VECTOR(ai,14)=NaN;
VECTOR(ai,15)=NaN;
VECTOR(ai,16)=NaN;
end
end
BEH_WithErrors{si}=VECTOR;
end
thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'};
CONDIS=[5,6,7,8,1,2,3,4];
PANEL=[1,1,2,2,4,4,5,5];
COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'};
for si=1:length(BEH_WithErrors)
VECTOR=BEH_WithErrors{si};
UNIQUES=unique(VECTOR(:,16));
UNIQUES=UNIQUES(UNIQUES>0);
for ai=1:8
Acc(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),6));
end
clear VECTOR;
end
figure; hold on
plot(1,mean(Acc(:,CONDIS(1))),COLOR{1});
plot(1,mean(Acc(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(Acc(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(Acc(:,CONDIS(condi))),std(Acc(:,CONDIS(condi)))/sqrt(size(Acc,1)),'k.');
end
plot([1 2],[mean(Acc(:,CONDIS(1))) mean(Acc(:,CONDIS(3)))],'k-');
plot([1 2],[mean(Acc(:,CONDIS(2))) mean(Acc(:,CONDIS(4)))],'k-');
plot([4 5],[mean(Acc(:,CONDIS(5))) mean(Acc(:,CONDIS(7)))],'k-');
plot([4 5],[mean(Acc(:,CONDIS(6))) mean(Acc(:,CONDIS(8)))],'k-');
ylabel('%');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('Acc');
Acc=1-Acc;
figure; hold on
plot(1,mean(Acc(:,CONDIS(1))),COLOR{1});
plot(1,mean(Acc(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(Acc(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(Acc(:,CONDIS(condi))),std(Acc(:,CONDIS(condi)))/sqrt(size(Acc,1)),'k.');
end
plot([1 2],[mean(Acc(:,CONDIS(1))) mean(Acc(:,CONDIS(3)))],'k-');
plot([1 2],[mean(Acc(:,CONDIS(2))) mean(Acc(:,CONDIS(4)))],'k-');
plot([4 5],[mean(Acc(:,CONDIS(5))) mean(Acc(:,CONDIS(7)))],'k-');
plot([4 5],[mean(Acc(:,CONDIS(6))) mean(Acc(:,CONDIS(8)))],'k-');
ylabel('err');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('Error Rate');
%% Do Beh
for si=1:length(BEH)
VECTOR=BEH{si};
UNIQUES=unique(VECTOR(:,16));
UNIQUES=UNIQUES(UNIQUES>0);
% % % ---------------- limit based on lowest epoch count % ---------------- % ----------------
% % for ai=1:8
% % TEMP_by_set{ai}=VECTOR(VECTOR(:,16)==UNIQUES(ai),:);
% % TEMP_by_set_SIZE(ai)=size(TEMP_by_set{ai},1);
% % end
% % TEMP_minsize=min(TEMP_by_set_SIZE);
% % % ----
% % for ai=1:8
% % TEMP_TRIALS=1:TEMP_by_set_SIZE(ai);
% % TEMP_TRIALS=shuffle(TEMP_TRIALS);
% % RT(si,ai)=squeeze(nanmean( TEMP_by_set{ai}(TEMP_TRIALS(1:TEMP_minsize),5) ));
% % clear TEMP_TRIALS
% % end
% % clear TEMP_by_set TEMP_by_set_SIZE TEMP_minsize TEMP_by_set_SIZE;
% % % ---------------- % ---------------- % ---------------- % ---------------- % ----------------
for ai=1:8
RT(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),5));
RTdiff(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),5))-nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),11));
end
clear VECTOR;
end
thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'};
CONDIS=[5,6,7,8,1,2,3,4];
PANEL=[1,1,2,2,4,4,5,5];
COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'};
figure; hold on
plot(1,mean(RT(:,CONDIS(1))),COLOR{1});
plot(1,mean(RT(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(RT(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(RT(:,CONDIS(condi))),std(RT(:,CONDIS(condi)))/sqrt(size(RT,1)),'k.');
end
plot([1 2],[mean(RT(:,CONDIS(1))) mean(RT(:,CONDIS(3)))],'k-');
plot([1 2],[mean(RT(:,CONDIS(2))) mean(RT(:,CONDIS(4)))],'k-');
plot([4 5],[mean(RT(:,CONDIS(5))) mean(RT(:,CONDIS(7)))],'k-');
plot([4 5],[mean(RT(:,CONDIS(6))) mean(RT(:,CONDIS(8)))],'k-');
ylabel('ms');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('RT');
figure; hold on
plot(1,mean(RTdiff(:,CONDIS(1))),COLOR{1});
plot(1,mean(RTdiff(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(RTdiff(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(RTdiff(:,CONDIS(condi))),std(RTdiff(:,CONDIS(condi)))/sqrt(size(RTdiff,1)),'k.');
end
plot([1 2],[mean(RTdiff(:,CONDIS(1))) mean(RTdiff(:,CONDIS(3)))],'k-');
plot([1 2],[mean(RTdiff(:,CONDIS(2))) mean(RTdiff(:,CONDIS(4)))],'k-');
plot([4 5],[mean(RTdiff(:,CONDIS(5))) mean(RTdiff(:,CONDIS(7)))],'k-');
plot([4 5],[mean(RTdiff(:,CONDIS(6))) mean(RTdiff(:,CONDIS(8)))],'k-');
ylabel('ms');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('RTdiff');
%% View Demographics
figure;
subplot(1,4,1:3); hold on
boxplot(MEGA_SUBJINFO(:,[3,5,6]));
ylabel('count');
set(gca,'xlim',[0 4],'xtick',[1:1:3],'xticklabel',{'Error %','Age','OCI'});
title('Demographics');
subplot(1,4,4); hold on
pie([sum(MEGA_SUBJINFO(:,4)==1),sum(MEGA_SUBJINFO(:,4)==2)])
title('Sex: % Male');
%% CONFLICT CONGRUENT
BigN=size(MEGA_ERP,1);
tx=-2000:2:1998;
t1=find(tx==-500); t2=find(tx==1000);
tx2disp=-500:2:1000;
P2=200; P2range=10; % in ms
N2=275; N2range=20;
P3=450; P3range=150;
LATE=700; LATErange=250;
figure;
subplot(4,1,1); hold on
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2);
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
title('FCz')
legend({'CONFLICT','CONGRUENT'})
subplot(4,1,2); hold on
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
title('Cz')
subplot(4,1,3); hold on
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
plot([LATE LATE],[-5 15],'m'); plot([LATE-LATErange LATE-LATErange],[-5 15],'c'); plot([LATE+LATErange LATE+LATErange],[-5 15],'c'); text(LATE,-5,'LATE');
title('Pz')
subplot(4,1,4); hold on
tx=-2000:2:1998;
LRP_t1=find(tx==-1000); LRP_t2=find(tx==500);
LRP_tx2disp=-1000:2:500;
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1))./sqrt(BigN),'r');
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1))./sqrt(BigN),'b');
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),'r','linewidth',2);
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1)),'b','linewidth',2);
plot([0 0],[-4 4],'k:'); plot([-1000 500],[0 0],'k:');
plot([-300 -300],[-2 2],'c'); plot([-150 -150],[-2 2],'c');
plot([-150 -150],[-2 2],'c'); plot([-50 -50],[-2 2],'c');
title('LRP')
%% REPEAT vs. SWITCH
figure;
site=19;
subplot(4,1,1); hold on
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),'g','linewidth',2);
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),'g','linewidth',2);
plot(mean(mean(RT(:,1:4))),[10],'ko');
plot(mean(mean(RT(:,5:8))),[10],'go');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
title('FCz')
legend({'REPEAT','SWITCH'})
subplot(4,1,2); hold on
site=28;
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),'g','linewidth',2);
plot(mean(mean(RT(:,1:4))),[10],'ko');
plot(mean(mean(RT(:,5:8))),[10],'go');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
title('Cz')
subplot(4,1,3); hold on
site=46;
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),'g','linewidth',2);
plot(mean(mean(RT(:,1:4))),[10],'ko');
plot(mean(mean(RT(:,5:8))),[10],'go');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
plot([LATE LATE],[-5 15],'m'); plot([LATE-LATErange LATE-LATErange],[-5 15],'c'); plot([LATE+LATErange LATE+LATErange],[-5 15],'c'); text(LATE,-5,'LATE');
title('Pz')
subplot(4,1,4); hold on
tx=-2000:2:1998;
LRP_t1=find(tx==-1000); LRP_t2=find(tx==500);
LRP_tx2disp=-1000:2:500;
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,1:4),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,1:4),3),1))./sqrt(BigN),'k');
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,5:8),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,5:8),3),1))./sqrt(BigN),'g');
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,1:4),3),1)),'k','linewidth',2);
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,5:8),3),1)),'g','linewidth',2);
plot([0 0],[-4 4],'k:'); plot([-1000 500],[0 0],'k:');
plot([-300 -300],[-2 2],'c'); plot([-150 -150],[-2 2],'c');
plot([-150 -150],[-2 2],'c'); plot([-50 -50],[-2 2],'c');
title('LRP')
%% PRIOR CONFLICT CONGRUENT for fun
thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'};
BigN=size(MEGA_ERP,1);
tx=-2000:2:1998;
t1=find(tx==-500); t2=find(tx==1000);
tx2disp=-500:2:1000;
P2=200; P2range=10; % in ms
N2=275; N2range=20;
P3=450; P3range=150;
LATE=700; LATErange=250;
figure;
subplot(4,1,1); hold on
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2);
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,2,5,6]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
title('FCz')
legend({'PRIOR CONFLICT','PRIOR CONGRUENT'})
subplot(4,1,2); hold on
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,2,5,6]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2');
plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
title('Cz')
subplot(4,1,3); hold on
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b');
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2);
plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2);
plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro');
plot(mean(mean(RT(:,[1,2,5,6]))),[10],'bo');
plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:');
plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3');
plot([LATE LATE],[-5 15],'m'); plot([LATE-LATErange LATE-LATErange],[-5 15],'c'); plot([LATE+LATErange LATE+LATErange],[-5 15],'c'); text(LATE,-5,'LATE');
title('Pz')
subplot(4,1,4); hold on
tx=-2000:2:1998;
LRP_t1=find(tx==-1000); LRP_t2=find(tx==500);
LRP_tx2disp=-1000:2:500;
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1))./sqrt(BigN),'r');
shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),3),1))./sqrt(BigN),'b');
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1)),'r','linewidth',2);
plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),3),1)),'b','linewidth',2);
plot([0 0],[-4 4],'k:'); plot([-1000 500],[0 0],'k:');
plot([-300 -300],[-2 2],'c'); plot([-150 -150],[-2 2],'c');
plot([-150 -150],[-2 2],'c'); plot([-50 -50],[-2 2],'c');
title('LRP')
%% ----- TRY THIS
figure;
subplot(2,1,1); hold on
site=19;
tx=-2000:2:1998;
resp_t1=find(tx==-500); resp_t2=find(tx==1000);
resp_tx2disp=-500:2:1000;
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),'b','linewidth',2);
shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,[2,4,6,8]),4),1))./sqrt(BigN),'r');
shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,[1,3,5,7]),4),1))./sqrt(BigN),'b');
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),'r','linewidth',2);
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),'b','linewidth',2);
plot([0 0],[-4 4],'k:'); plot([-500 1000],[0 0],'k:');
plot([200 200],[-2 2],'c'); plot([500 500],[-2 2],'c');
title('Resp')
legend({'CONGRUENT','CONFLICT'})
subplot(2,1,2); hold on
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),'k','linewidth',2);
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),'g','linewidth',2);
shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,1:4),4),1))./sqrt(BigN),'k');
shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,5:8),4),1))./sqrt(BigN),'g');
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),'k','linewidth',2);
plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),'g','linewidth',2);
plot([0 0],[-4 4],'k:'); plot([-500 1000],[0 0],'k:');
plot([200 200],[-2 2],'c'); plot([500 500],[-2 2],'c');
title('Resp')
legend({'REPEAT','SWITCH'})
ERPmean=squeeze(mean(MEGA_ERP_RESP_All(:,site,find(tx==200):find(tx==500),:),3)); LRP_TITLE='FCz Resp';
CONDIS=[5,6,7,8,1,2,3,4];
PANEL=[1,1,2,2,4,4,5,5];
COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'};
figure; hold on
plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1});
plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.');
end
plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-');
plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-');
ylabel('uV');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title(LRP_TITLE);
FCzRESP_4SPSS=squeeze(mean(MEGA_ERP_RESP_All(:,site,find(tx==200):find(tx==500),:),3));
figure;
subplot(1,2,1)
resp_t1=find(tx==200); resp_t2=find(tx==500);
A=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,[2,4,6,8]),4),3);
B=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,[1,3,5,7]),4),3);
[H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0;
THESEDATA=squeeze(mean(A,1)-mean(B,1));
topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1});
title('CONF-CONGRU')
subplot(1,2,2)
resp_t1=find(tx==200); resp_t2=find(tx==500);
A=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,1:4),4),3);
B=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,5:8),4),3);
[H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0;
THESEDATA=squeeze(mean(B,1)-mean(A,1));
topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1});
title('SWITCH-REPEAT')
%% TOPOS
% Divide range by 2 to get samples
TIMEWINS{1}=find(tx==P2)-5:find(tx==P2)+5 ;
TIMEWINS{2}=find(tx==N2+1)-10:find(tx==N2+1)+10 ;
TIMEWINS{3}=find(tx==P3)-(P3range/2):find(tx==P3)+(P3range/2) ;
TIMEWINS{4}=find(tx==LATE)-(LATErange/2):find(tx==LATE)+(LATErange/2) ;
TITLES={'P2','N2','P3','Late'};
figure;
for fi=2:4
subplot(1,3,fi-1); hold on;
A=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},[2,4,6,8]),4),3);
B=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},[1,3,5,7]),4),3);
[H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0;
THESEDATA=squeeze(mean(A,1)-mean(B,1));
topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1});
title(TITLES{fi})
clear THESEDATA A B;
end
figure;
for fi=2:4
subplot(1,3,fi-1); hold on;
A=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},5:8),4),3);
B=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},1:4),4),3);
[H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0;
THESEDATA=squeeze(mean(A,1)-mean(B,1));
topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1});
title(TITLES{fi})
clear THESEDATA A B;
end
%% Get ROIs
SITE=[19,28,46];
for ai=1:3 % SITE=[FCz,Cz,Pz]
for bi=1:4 % TIMES=[P2,N2,P3,LATE];
for ci=1:8
MEANS(:,ai,bi,ci)=squeeze(mean(MEGA_ERP(:,SITE(ai),TIMEWINS{bi},ci),3));
end
end
end
TIMEWINS_LAT=find(tx==P3)-(P3range/2):find(tx==P3)+(P3range/2) ; % 300 to 600
P3actuallatency=P3-P3range:2:P3+P3range;
for si=1:size(MEGA_ERP,1)
for ai=1:3 % SITE=[FCz,Cz,Pz]
for ci=1:8
idx=find(squeeze(MEGA_ERP(si,SITE(ai),TIMEWINS_LAT,ci))==max(squeeze(MEGA_ERP(si,SITE(ai),TIMEWINS_LAT,ci))));
P3Latency(si,ai,ci)=P3actuallatency(idx);
end
end
end
figure; boxplot(squeeze(P3Latency(:,3,:))); title('P3 latencies at Pz');
P3Peak_Conf=mean(mean(P3Latency(:,3,[2,4,6,8]),3));
P3Peak_Cong=mean(mean(P3Latency(:,3,[1,3,5,7]),3));
P3Peak_Rep=mean(mean(P3Latency(:,3,1:4),3));
P3Peak_Swtch=mean(mean(P3Latency(:,3,5:8),3));
%%
clear ERPmean;
CHAN=3 ;% SITE=[FCz,Cz, Pz]
TIME=4 ;% TIMES=[P2,N2,P3,LATE];
ERPmean=squeeze(mean(MEANS(:,CHAN,TIME,:),2)); % -squeeze(MEANS(:,CHAN,2,:)); %
% ERPmean=squeeze(mean(P3Latency(:,3,:),2));
% % AMP=zscore(squeeze(mean(MEANS(:,CHAN,TIME,:),2)),[],2);
% % LAT=zscore(squeeze(mean(P3Latency(:,3,:),2)),[],2);
% % ERPmean=(AMP+LAT)/2;
TITLE=' ';
% N2 is FCz
% P3 is Cz, Pz
% P3 latency is Pz
CONDIS=[5,6,7,8,1,2,3,4];
PANEL=[1,1,2,2,4,4,5,5];
COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'};
figure; hold on
plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1});
plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.');
end
plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-');
plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title(TITLE);
%%
lrp1=find(tx==-300);
lrp2=find(tx==-150);
lrp3=find(tx==-50);
ERPmean=-1* (squeeze(mean(MEGA_ERP_RESP(:,lrp3,:),2))-squeeze(mean(MEGA_ERP_RESP(:,lrp2,:),2)) ); LRP_TITLE='LRP SLOPE';
% ERPmean=squeeze(mean(MEGA_ERP_RESP(:,lrp1:lrp2,:),2)); LRP_TITLE='PRE-LRP';
CONDIS=[5,6,7,8,1,2,3,4];
PANEL=[1,1,2,2,4,4,5,5];
COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'};
figure; hold on
plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1});
plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.');
end
plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-');
plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-');
plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-');
ylabel('uV');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title(LRP_TITLE);
LRP_4SPSS=squeeze(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,:),2));
%% TF
frex=logspace(.01,1.7,50);
figure; hold on;
imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PWR{1},1),4)));
% [H,P,CI,STATS]=ttest(squeeze( CTL.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)) , squeeze( ON.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)));
% P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1; P=squeeze(P);
% contour(tx2disp,1:50,P,'k','linewidth',2); clear Corrected_P H P CI STATS;
plot([300 300],[17 24],'k'); plot([500 500],[17 24],'k');
plot([300 500],[17 17],'k') ;plot([300 500],[24 24],'k');
plot([0 0],[1 50],'k:')
set(gca,'clim',[-4 4],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));
CUETHETA_4SPSS=squeeze(mean(mean(MEGA_PWR{1}(:,17:24,find(tx2disp==300):find(tx2disp==500),:),2),3));
figure; hold on
plot(1,mean(CUETHETA_4SPSS(:,CONDIS(1))),COLOR{1});
plot(1,mean(CUETHETA_4SPSS(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(CUETHETA_4SPSS(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(CUETHETA_4SPSS(:,CONDIS(condi))),std(CUETHETA_4SPSS(:,CONDIS(condi)))/sqrt(size(CUETHETA_4SPSS,1)),'k.');
end
plot([1 2],[mean(CUETHETA_4SPSS(:,CONDIS(1))) mean(CUETHETA_4SPSS(:,CONDIS(3)))],'k-');
plot([1 2],[mean(CUETHETA_4SPSS(:,CONDIS(2))) mean(CUETHETA_4SPSS(:,CONDIS(4)))],'k-');
plot([4 5],[mean(CUETHETA_4SPSS(:,CONDIS(5))) mean(CUETHETA_4SPSS(:,CONDIS(7)))],'k-');
plot([4 5],[mean(CUETHETA_4SPSS(:,CONDIS(6))) mean(CUETHETA_4SPSS(:,CONDIS(8)))],'k-');
ylabel('uV');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('Cue Theta');
figure; hold on;
imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PWR{2},1),4)));
% [H,P,CI,STATS]=ttest(squeeze( CTL.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)) , squeeze( ON.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)));
% P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1; P=squeeze(P);
% contour(tx2disp,1:50,P,'k','linewidth',2); clear Corrected_P H P CI STATS;
plot([-200 -200],[17 24],'k'); plot([50 50],[17 24],'k');
plot([-200 50],[17 17],'k') ;plot([-200 50],[24 24],'k');
plot([0 0],[1 50],'k:')
set(gca,'clim',[-2 2],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));
RESPTHETA_4SPSS=squeeze(mean(mean(MEGA_PWR{2}(:,17:24,find(tx2disp==-200):find(tx2disp==50),:),2),3));
figure; hold on
plot(1,mean(RESPTHETA_4SPSS(:,CONDIS(1))),COLOR{1});
plot(1,mean(RESPTHETA_4SPSS(:,CONDIS(2))),COLOR{2});
legend({'CONG','INCONG'},'Location','NorthWest')
for condi=1:8
plot(PANEL(condi),mean(RESPTHETA_4SPSS(:,CONDIS(condi))),COLOR{condi});
errorbar(PANEL(condi),mean(RESPTHETA_4SPSS(:,CONDIS(condi))),std(RESPTHETA_4SPSS(:,CONDIS(condi)))/sqrt(size(RESPTHETA_4SPSS,1)),'k.');
end
plot([1 2],[mean(RESPTHETA_4SPSS(:,CONDIS(1))) mean(RESPTHETA_4SPSS(:,CONDIS(3)))],'k-');
plot([1 2],[mean(RESPTHETA_4SPSS(:,CONDIS(2))) mean(RESPTHETA_4SPSS(:,CONDIS(4)))],'k-');
plot([4 5],[mean(RESPTHETA_4SPSS(:,CONDIS(5))) mean(RESPTHETA_4SPSS(:,CONDIS(7)))],'k-');
plot([4 5],[mean(RESPTHETA_4SPSS(:,CONDIS(6))) mean(RESPTHETA_4SPSS(:,CONDIS(8)))],'k-');
ylabel('uV');
set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'});
title('Resp Theta');
figure; hold on;
imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PHS{1},1),4)));
plot([100 100],[17 24],'k'); plot([300 300],[17 24],'k');
plot([100 300],[17 17],'k') ;plot([100 300],[24 24],'k');
plot([0 0],[1 50],'k:')
set(gca,'clim',[0 .5],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));
CUEPHS_4SPSS=squeeze(mean(mean(MEGA_PHS{1}(:,17:24,find(tx2disp==100):find(tx2disp==300),:),2),3));
figure; hold on;
imagesc(-1000:2:500,[],squeeze(mean(mean(MEGA_PHS{2},1),4)));
plot([100 100],[2 10],'k'); plot([300 300],[2 10],'k');
plot([100 300],[2 2],'k') ;plot([100 300],[10 10],'k');
plot([0 0],[1 50],'k:')
set(gca,'clim',[0 .5],'xlim',[-1000,500],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));
%%
|