Skip to content

Commit fd86c5b

Browse files
Merge pull request #1 from neuroprismlab/state_of_power
Preparing for discovery transfer
2 parents b6b5a6c + 3c41701 commit fd86c5b

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

NBS_benchmarking/setup_benchmarking.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
RepParams.n_workers = RepParams.test_n_workers;
2222
end
2323

24+
% Get the level - edge-level, network-level, or whole brain level
25+
RepParams.stat_level = set_statistic_level(RepParams.cluster_stat_type);
2426

2527
%% Adjust NBS Method According to Stat Type
2628
% special setup for nonparametric FDR (part of classic NBS toolbox) and parametric FDR and Bonferroni (newly added here) since can't run it using cluster_stat_type
0 Bytes
Binary file not shown.

config_files/setparams.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@
6262
Params.n_subs_subset = 40; % 40 | 80 | 120
6363

6464
%% List of subjects per subset
65-
Params.list_of_nsubset = {20, 40, 80, 120}; % To change this, add more when necessary
66-
Params.list_of_nsubset = {40}; % Redefined because I need a base with all 40 first
65+
Params.list_of_nsubset = {20, 40, 80, 120, 200}; % To change this, add more when necessary
6766
% size of subset is full group size (N=n*2 for two sample t-test or N=n for one-sample)
6867

6968

@@ -111,7 +110,7 @@
111110
%%%%% DEVELOPERS ONLY %%%%%
112111
% Use a small subset of permutations for faster development -- inappropriate for inference
113112

114-
Params.testing = true;
113+
Params.testing = false;
115114
Params.test_n_perms = '100';
116115
Params.test_n_repetitions = 1;
117116
Params.test_n_workers = 10;

power_calculator_tools/rep_cal_function.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function rep_cal_function(Params)
1212

1313
%% Parallel Workers
1414
% Uncoment the disp line if setup is commented out - as reminder
15-
% setup_parallel_workers(Params.parallel, Params.n_workers);
16-
disp('Debugging: Setup parallel workers deactived')
15+
setup_parallel_workers(Params.parallel, Params.n_workers);
16+
% disp('Debugging: Setup parallel workers deactived')
1717

1818
OutcomeData = Dataset.outcome;
1919
BrainData = Dataset.brain_data;

run_benchmarking.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ function run_benchmarking(RP, Y)
122122
%% Run NBS repetitions
123123

124124
% Be careful with this parfor commented lol
125-
% parfor (i_rep=1: RP.n_repetitions)
125+
parfor (i_rep=1: RP.n_repetitions)
126126

127127
% Do not erase the comment bellow, it is used for debugging
128128
% when running not in parallel
129-
disp('Parof'); for i_rep = 1:RP.n_repetitions
129+
% disp('Parof'); for i_rep = 1:RP.n_repetitions
130130

131131
% Encapsulation of the most computationally intensive loop
132132
[FWER_rep, edge_stats_all_rep, pvals_all_rep, cluster_stats_all_rep, ...
@@ -141,13 +141,21 @@ function run_benchmarking(RP, Y)
141141
edge_stats_all_neg(:,i_rep) = edge_stats_all_neg_rep;
142142
pvals_all_neg(:,i_rep) = pvals_all_neg_rep;
143143

144-
if ~isempty(cluster_stats_all_rep) || ~isempty(cluster_stats_all_neg_rep)
144+
% If it is an edge method, no need for the
145+
% network stats
146+
if ~strcmp(RP.stat_level, 'edge')
145147
cluster_stats_all(:,:,i_rep) = cluster_stats_all_rep;
146148
cluster_stats_all_neg(:,:,i_rep) = cluster_stats_all_neg_rep;
147149
end
148150

149151
end
150152

153+
% An NaN for network-level in the edge case
154+
if strcmp(RP.stat_level, 'edge')
155+
cluster_stats_all = NaN;
156+
cluster_stats_all_neg = NaN;
157+
end
158+
151159
if contains(UI.statistic_type.ui,'Constrained') || strcmp(UI.statistic_type.ui,'SEA') ...
152160
|| strcmp(UI.statistic_type.ui,'Omnibus')
153161
cluster_stats_all = squeeze(cluster_stats_all);

0 commit comments

Comments
 (0)