File size: 4,947 Bytes
2e77130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
%%
COLS={'c','m'};
ROWS={'1-2','1-3','2-3'};
figure;
for si=1:2
    Sx=logical( double(IDENTITY.DEMO(:,3)==si)  );
    Sx_idxs=unique(IDENTITY.DEMO(Sx,1));
    
    clear IV* DV* *12 *23 *13; 
    for sxi=1:length(Sx_idxs)
        thisguy=Sx_idxs(sxi);

        FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
        SECOND=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==2) ));
        THIRD=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==3) ));
        
        if ~isempty(FIRST) && ~isempty(SECOND)
            IVs12(sxi,:)= squeeze(mean(MEGA_ERP(FIRST,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3))  ;
            DVs12(sxi,:)=IDENTITY.QUEX(SECOND,quexidx)-IDENTITY.QUEX(FIRST,quexidx);
            age12(sxi,:)=IDENTITY.QUEX(FIRST,6);
            TOPF12(sxi,:)=IDENTITY.NP(FIRST,4);
            sex12(sxi,:)=IDENTITY.DEMO(FIRST,5);
            % NP vars that also predicted dropout
            Span12(sxi,:)=IDENTITY.NP(FIRST,6);
            Coding12(sxi,:)=IDENTITY.NP(FIRST,5);
        else
            IVs12(sxi,:)=NaN;
            DVs12(sxi,:)=NaN;
            age12(sxi,:)=NaN;
            TOPF12(sxi,:)=NaN;
            sex12(sxi,:)=NaN;
        end
        
       if ~isempty(SECOND) && ~isempty(THIRD)
            IVs23(sxi,:)= squeeze(mean(MEGA_ERP(SECOND,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3)) ;
            DVs23(sxi,:)=IDENTITY.QUEX(THIRD,quexidx)-IDENTITY.QUEX(SECOND,quexidx);
        else
            IVs23(sxi,:)=NaN;
            DVs23(sxi,:)=NaN;
        end
        
        if ~isempty(FIRST) && ~isempty(THIRD)
            IVs13(sxi,:)= squeeze(mean(MEGA_ERP(FIRST,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3))  ;
            DVs13(sxi,:)=IDENTITY.QUEX(THIRD,quexidx)-IDENTITY.QUEX(FIRST,quexidx);
        else
            IVs13(sxi,:)=NaN;
            DVs13(sxi,:)=NaN;
        end

    end

    % --------------------

    [rho,rho_p]=corr(IVs12,DVs12,'type','Spearman','rows','pairwise');
    [r,p]=corr(IVs12,DVs12,'type','Pearson','rows','pairwise');
    subplot(3,2,si); hold on
    scatter(IVs12,DVs12,COLS{si}); lsline
    set(gca,'xlim',[-10 20],'ylim',[-40 40]);
    text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs12)).*double(~isnan(DVs12)))) -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
    text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs12)).*double(~isnan(DVs12)))) -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
    clear rho rho_p r p IV
    title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,'   S1EEG    ',ROWS{1}] );
    
    % --------------------

    [rho,rho_p]=corr(IVs13,DVs13,'type','Spearman','rows','pairwise');
    [r,p]=corr(IVs13,DVs13,'type','Pearson','rows','pairwise');
    subplot(3,2,si+2); hold on
    scatter(IVs13,DVs13,COLS{si}); lsline
    set(gca,'xlim',[-10 20],'ylim',[-40 40]);
    text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs13)).*double(~isnan(DVs13))))  -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
    text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs13)).*double(~isnan(DVs13))))  -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
    clear rho rho_p r p IV
    title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,'   S1EEG    ',ROWS{2}] );
    
    % --------------------

    [rho,rho_p]=corr(IVs23,DVs23,'type','Spearman','rows','pairwise');
    [r,p]=corr(IVs23,DVs23,'type','Pearson','rows','pairwise');
    subplot(3,2,si+4); hold on
    scatter(IVs23,DVs23,COLS{si}); lsline
    set(gca,'xlim',[-10 20],'ylim',[-40 40]);
    text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs23)).*double(~isnan(DVs23))))  -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
    text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs23)).*double(~isnan(DVs23))))  -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
    clear rho rho_p r p IV
    title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,'   S1EEG    ',ROWS{3}] );
     
    % --------------------

end

 
% Check demographic (S1) vars in the sub-acute group on FrSBe change

[r,p]=corr(DVs12,age12,'type','Spearman','rows','pairwise')

[r,p]=corr(DVs12,TOPF12,'type','Spearman','rows','pairwise')

[H,P,CI,STATS]=ttest2(DVs12(sex12==1),DVs12(sex12==0))

[r,p]=corr(DVs12,Span12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs12,Coding12,'type','Spearman','rows','pairwise')

   
   

[r,p]=corr(DVs13,age12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs13,TOPF12,'type','Spearman','rows','pairwise')
[H,P,CI,STATS]=ttest2(DVs13(sex12==1),DVs13(sex12==0))
[r,p]=corr(DVs13,Span12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs13,Coding12,'type','Spearman','rows','pairwise')