-
Notifications
You must be signed in to change notification settings - Fork 28
Getting stats results with a script
This is useful to script when many files/results need to be read at certain locations. This is illustrated here on an ANCOVA on ERP (channel*time): we want to know the effect of covariates where and when the condition effect is significant.
Here using spatial-temporal clustering with a cluster defining threshold at p 0.05
LIMO = load(fullfile(pwd,'LIMO.mat')); LIMO = LIMO.LIMO;
[pvalues, mask] = limo_stat_values('Condition_effect_1.mat', 0.05, 2, LIMO);
The resulting mask here has 2 clusters and it is labelled in from 0 to N. NOTE if using max or tfce, there is no cluster and mask is a binary image (0 and 1) only
Ncluster = length(unique(mask))-1; % -1 because 0 does not count
figure; imagesc(mask); title('significant cells');
cond_clusters = limo_get_summary('Condition_effect_1.mat',mask);
cov1_clusters = limo_get_summary('Covariate_effect_1.mat',mask);
cov2_clusters = limo_get_summary('Covariate_effect_2.mat',mask);
3 - Report, making use of LIMO.mat to get some information.
for c=1:Ncluster
roi = mask == c; % get the cluster c
% cluster info
sig_times = find(sum(roi,1)); % find non 0 in time (sum over space)
sig_chan = find(sum(roi,2)); % find non 0 in space (sum over time)
fprintf('cluster %g: starts at %g, stops at %g\n',c,...
LIMO.data.timevect(min(sig_times)),LIMO.data.timevect(max(sig_times)))
channames = arrayfun(@(x) x.labels, LIMO.data.chanlocs(sig_chan), 'UniformOutput', false);
for n=1:length(channames)
if n==1
fprintf('cluster %g: covers channels %s ',c, channames{n})
elseif n == length(channames)
fprintf('%s\n',channames{n})
else
fprintf('%s ',channames{n})
end
end
fprintf('mean F values condition:%g cov1:%g cov2:%g\n', ...
cond_clusters(c).mean,cov1_clusters(c).mean,cov2_clusters(c).mean)
end
What if we use TFCE - ie no clusters
[pvalues, mask] = limo_stat_values('Condition_effect_1.mat', 0.05, 3, LIMO);
Here, we are 'making up' clusters, looking at which cells are contiguous in terms of significance, this is not the same as spatial-temporal clustering but an appreciations of regional effects, which makes sense because tfce scores indicate that they belong to clusters. See how to report results here.
[cond_clusters,madeupclusters] = limo_get_summary('Condition_effect_1.mat',mask);
cov1_clusters = limo_get_summary('Covariate_effect_1.mat',madeupclusters);
cov2_clusters = limo_get_summary('Covariate_effect_2.mat',madeupclusters);
for c=1:(length(unique(madeupclusters))-1)
roi = madeupclusters == c; % get the cluster c
% cluster info
sig_times = find(sum(madeupclusters,1)); % find non 0 in time (sum over space)
sig_chan = find(sum(madeupclusters,2)); % find non 0 in space (sum over time)
fprintf('tfce regional effect %g: starts at %g, stops at %g\n',c,...
LIMO.data.timevect(min(sig_times)),LIMO.data.timevect(max(sig_times)))
channames = arrayfun(@(x) x.labels, LIMO.data.chanlocs(sig_chan), 'UniformOutput', false);
for n=1:length(channames)
if n==1
fprintf('regional effect %g: covers channels %s ',c, channames{n})
elseif n == length(channames)
fprintf('%s\n',channames{n})
else
fprintf('%s ',channames{n})
end
end
fprintf('mean F values condition:%g cov1:%g cov2:%g\n', ...
cond_clusters(c).mean,cov1_clusters(c).mean,cov2_clusters(c).mean)
end
Downsampling or not before analyzing
Defining conditions defining
~ categorical.txt ~continuous.txt
EEGLAB-STUDY: run, session, condition and group
Basic Stats: LIMO tests and CI
Repeated measures ANOVA
Results in the workspace
Results in LIMO.cache
Checking data under the plots
Reordering plots
Compute & Plot conditions
Compute & Plot differences
Channel neighbourhood
Editing a neighbourhood matrix
Scripting 1st level
Debugging 1st level errors
Skip 1st level
Scripting 2nd level
Getting stats results with a script