Getting stats results with a script - LIMO-EEG-Toolbox/limo_tools GitHub Wiki
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.
Spatial-temporal clustering
For1 - Call limo_stat_values for the results
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');
2 - Get summary statistics from clusters
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);
LIMO.mat to get some information.
3 - Report, making use offor 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
TFCE - ie no clusters
What if we use1 - Call limo_stat_values for the results
[pvalues, mask] = limo_stat_values('Condition_effect_1.mat', 0.05, 3, LIMO);
2 - Get summary statistics
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);
3 - Report
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