Repository navigation
Expand file tree
/
Copy pathStep4_t_test_script.m
More file actions
69 lines (50 loc) · 2.06 KB
/
Copy pathStep4_t_test_script.m
File metadata and controls
69 lines (50 loc) · 2.06 KB
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
%% do t-tests to see group differences between the components using loadings
%load SPECT_CoM_Workspace
% Run t-test
hcind = 1:76;
szind = 77:213;
[h, p, ci, stats] = ttest2(a(hcind,:),a(szind,:)); %now, run t-test between loading parameters to test group differences
% Extract significant p-values
sig_idx_p = find(p < 0.05);
p_sig = p(sig_idx_p);
% Round to 2 decimals
p_sig_rounded = round(p_sig, 2);
%% repeat same process but for q values, get components with loadings that passed threshold
%% correct for FDR correction
q = mafdr(p); %correct p vals for FDR correction
%% Vince check: q_significant_loadings_group_differences = sum(mafdr(2*(1-tcdf(stats.tstat,212)))<0.05); revealed 9 comps
%using my 23 components for display
% Extract significant q-values
sig_idx_q = find(q < 0.05);
%list which ones match Dom_SubDom networks as labels to see
%domains/subdomains of FDR corrected results
sig_idx_q_labels= DomSubDom_Reordered(idx);
%% see if sig_idx_p and sig_idx_q match - did the same components remain
% Find common significant components
common_idx = intersect(sig_idx_p, sig_idx_q);
% Display results
disp('Common significant indices (p and q):');
disp(common_idx);
%% see if there are differences between components in sig results
p_only = setdiff(sig_idx_p, sig_idx_q);
q_only = setdiff(sig_idx_q, sig_idx_p);
disp('Significant in p only:');
disp(p_only);
disp('Significant in q only:');
disp(q_only);
%% list which components from q values are have values of <0.05 and <0.01
%% list components passing q thresholds
%% list components by q-value thresholds for bar plot step (step 6)
%efficiently organize data to understand which are significant, and highly
%significant
% Components between 0.01 and 0.05
q_idx_between = find(q >= 0.01 & q < 0.05);
disp('Components with 0.01 <= q < 0.05:');
disp(q_idx_between);
% Components with q < 0.01
q_idx_001 = find(q < 0.01);
disp('Components with q < 0.01:');
disp(q_idx_001);
q_idx_between = DomSubDom_Reordered(idx); % matching labels
%looks like they remained in both
%% go to step 4a to clean and sort components