Skip to content

Commit f783e28

Browse files
author
Eric Fields
committed
various further updates to sphericity correction functionality
1 parent c8bf726 commit f783e28

11 files changed

Lines changed: 58 additions & 29 deletions

FMUT_release_notes.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0.5.0-alpha
1+
# 0.5.0
22

33
## Installation instructions
44

@@ -13,11 +13,7 @@ The FMUT documentation can be found at: https://github.com/ericcfields/FMUT/wiki
1313
## Release Notes
1414

1515
### New features
16-
* `FfdrGND` (and relevant sub-functions) can now include a sphericity correction as long as there are no more than two factors with more than two levels
17-
18-
### Backwards compatibility
19-
* A new field, `sphericity_corr`, has been added to the `F_tests` struct. Attempts to add results to a GND or GRP with results missing this field (i.e., from a previous version of FMUT) will result in an error.
20-
* See also Refactoring section below
16+
* `FfdrGND` (and relevant sub-functions) can now include a sphericity correction as long as there are no more than two factors with more than two levels.
2117

2218
### Bug fixes
2319
* `get_mean_amplitude` now removes commas from group and bin names in csv output to avoid formatting issues

FclustGND.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
%
135135
%
136136
%AUTHOR: Eric Fields
137-
%VERSION DATE: 9 June 2020
137+
%VERSION DATE: 11 June 2020
138138
%
139139
%NOTE: This function is provided "as is" and any express or implied warranties
140140
%are disclaimed.
@@ -441,6 +441,9 @@
441441
if ~isfield(GND, 'F_tests') || isempty(GND.F_tests)
442442
GND.F_tests = results;
443443
else
444+
if ~isfield(GND.F_tests, 'sphericity_corr')
445+
[GND.F_tests(:).sphericity_corr] = deal('none');
446+
end
444447
GND.F_tests(end+1) = results;
445448
end
446449

FclustGRP.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
%
145145
%
146146
%AUTHOR: Eric Fields
147-
%VERSION DATE: 9 June 2020
147+
%VERSION DATE: 11 June 2020
148148
%
149149
%NOTE: This function is provided "as is" and any express or implied warranties
150150
%are disclaimed.
@@ -496,6 +496,9 @@
496496
if ~isfield(GRP, 'F_tests') || isempty(GRP.F_tests)
497497
GRP.F_tests = results;
498498
else
499+
if ~isfield(GRP.F_tests, 'sphericity_corr')
500+
[GRP.F_tests(:).sphericity_corr] = deal('none');
501+
end
499502
GRP.F_tests(end+1) = results;
500503
end
501504

FfdrGND.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
%
121121
%
122122
%AUTHOR: Eric Fields
123-
%VERSION DATE: 9 June 2020
123+
%VERSION DATE: 11 June 2020
124124
%
125125
%NOTE: This function is provided "as is" and any express or implied warranties
126126
%are disclaimed.
@@ -269,6 +269,9 @@
269269
if ~all(all(GND.indiv_bin_ct(:, bins)))
270270
watchit(sprintf('Some subjects appear to be missing data from bins used in this test!\nSee: GND.indiv_bins_ct.'));
271271
end
272+
if ~strcmpi(p.Results.sphericity_corr, 'none') && sum(factor_levels>2)>1
273+
error('Sphericity corrections are currently not available for designs with more than one factor with more than two levels');
274+
end
272275

273276

274277
%% ~~~~~ SET-UP ~~~~~
@@ -419,6 +422,11 @@
419422
if ~isfield(GND, 'F_tests') || isempty(GND.F_tests)
420423
GND.F_tests = results;
421424
else
425+
%Add sphericity_corr field if existing results were generated with
426+
%with FMUT version <0.5
427+
if ~isfield(GND.F_tests, 'sphericity_corr')
428+
[GND.F_tests(:).sphericity_corr] = deal('none');
429+
end
422430
GND.F_tests(end+1) = results;
423431
end
424432

FfdrGRP.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
%
132132
%
133133
%AUTHOR: Eric Fields
134-
%VERSION DATE: 9 June 2020
134+
%VERSION DATE: 11 June 2020
135135
%
136136
%NOTE: This function is provided "as is" and any express or implied warranties
137137
%are disclaimed.
@@ -166,6 +166,7 @@
166166
p.addParameter('plot_raster', 'yes', @(x) (any(strcmpi(x, {'yes', 'no', 'n', 'y'}))));
167167
p.addParameter('q', 0.05, @(x) (isnumeric(x) && x<=1 && x>=0));
168168
p.addParameter('method', 'bh', @(x) any(strcmpi(x, {'bh', 'by', 'bky', 'none', 'bonferroni', 'sidak'})));
169+
p.addParameter('sphericity_corr', 'none', @(x) (any(strcmpi(x, {'gg', 'hf', 'lb', 'none'}))));
169170
p.addParameter('time_block_dur', []);
170171
p.addParameter('plot_gui', []);
171172
p.addParameter('plot_mn_topo', []);
@@ -292,6 +293,9 @@
292293
if max(time_wind(:)) > max(GRP.time_pts)
293294
error('Epoch ends at %.1f ms, but ''time_wind'' input ends at %.1f ms', max(GRP.time_pts), max(time_wind(:)));
294295
end
296+
if ~strcmpi(p.Results.sphericity_corr, 'none')
297+
error('Sphericity corrections are currently not available for designs with a between subject factor');
298+
end
295299

296300

297301
%% ~~~~~ SET-UP ~~~~~
@@ -469,6 +473,9 @@
469473
if ~isfield(GRP, 'F_tests') || isempty(GRP.F_tests)
470474
GRP.F_tests = results;
471475
else
476+
if ~isfield(GRP.F_tests, 'sphericity_corr')
477+
[GRP.F_tests(:).sphericity_corr] = deal('none');
478+
end
472479
GRP.F_tests(end+1) = results;
473480
end
474481

FmaxGND.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
%See the FMUT documentation for more information:
109109
%https://github.com/ericcfields/FMUT/wiki
110110
%
111-
%VERSION DATE: 9 June 2020
111+
%VERSION DATE: 11 June 2020
112112
%AUTHOR: Eric Fields
113113
%
114114
%NOTE: This function is provided "as is" and any express or implied warranties
@@ -428,6 +428,9 @@
428428
if ~isfield(GND, 'F_tests') || isempty(GND.F_tests)
429429
GND.F_tests = results;
430430
else
431+
if ~isfield(GND.F_tests, 'sphericity_corr')
432+
[GND.F_tests(:).sphericity_corr] = deal('none');
433+
end
431434
GND.F_tests(end+1) = results;
432435
end
433436

FmaxGRP.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
%https://github.com/ericcfields/FMUT/wiki
122122
%
123123
%
124-
%VERSION DATE: 9 June 2020
124+
%VERSION DATE: 11 June 2020
125125
%AUTHOR: Eric Fields
126126
%
127127
%NOTE: This function is provided "as is" and any express or implied warranties
@@ -490,6 +490,9 @@
490490
if ~isfield(GRP, 'F_tests') || isempty(GRP.F_tests)
491491
GRP.F_tests = results;
492492
else
493+
if ~isfield(GRP.F_tests, 'sphericity_corr')
494+
[GRP.F_tests(:).sphericity_corr] = deal('none');
495+
end
493496
GRP.F_tests(end+1) = results;
494497
end
495498

estimate_epsilon.m

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
%Calculate the Greenhouse-Geisser or Hyunh-Feldt estimate of epsilon at all
2-
%time points and electrodes
1+
%Calculate the Greenhouse-Geisser, Hyunh-Feldt, or lower bound estimate
2+
%of epsilon at all time points and electrodes
33
%
44
%EXAMPLE USAGE
55
% >> epsilon = estimate_epsilon(data, [], 3, 'gg');
@@ -19,13 +19,13 @@
1919
% calculate the main effect of A, dims = 3. If you want to
2020
% calculate the AxB interaciton, dims = [3, 4].
2121
% method - 'gg': Greenhouse-Geisser, 'hf':Hyunh-Feldt, or 'lb':
22-
% lower bound
22+
% lower bound {default: 'gg'}
2323
%
2424
%OUTPUT
25-
% epsilon - electrode x time point array of GG estimate of epsilon
25+
% epsilon - electrode x time point array of epsilon estimate
2626
%
2727
%
28-
%VERSION DATE: 9 June 2020
28+
%VERSION DATE: 11 June 2020
2929
%AUTHOR: Eric Fields
3030
%
3131
%NOTE: This function is provided "as is" and any express or implied warranties
@@ -50,11 +50,6 @@
5050
%Get data reduced for analysis
5151
reduced_data = reduce_data(data, dims);
5252

53-
%Get some useful numbers
54-
assert(ndims(reduced_data)==4);
55-
[n_electrodes, n_time_pts, n_conds, n_subs] = size(reduced_data);
56-
df_effect = n_conds - 1;
57-
5853
%This function currently only works for one-way fully repeated measures designs
5954
if ~isempty(cond_subs) && ~isequal(cond_subs, 0) && length(cond_subs) > 1
6055
error('estimate_epsilon curently only implemented for fully repetaed measures ANOVA');
@@ -63,6 +58,10 @@
6358
error('estimate_epsilon currently does not support more than one factor with more than 2 levels');
6459
end
6560

61+
%Get some useful numbers
62+
[n_electrodes, n_time_pts, n_conds, n_subs] = size(reduced_data);
63+
df_effect = n_conds - 1;
64+
6665
if strcmpi(method, 'lb')
6766

6867
%Lower bound on epsilon

get_mean_amplitude.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
%returned for each subject and bin involved in the test.
44
%
55
%Note that care should be taken with regard to analyses conducted on such
6-
%mean amplitudes: if analyses are not statistically indpendent of the
7-
%original mass univariate test, results will be biased. See:
8-
%Kriegeskorte, N., Simmons, W. K., Bellgowan, P. S., & Baker, C. I. (2009). Circular analysis in systems neuroscience: the dangers of double dipping. Nature Neuroscience, 12(5), 535.
6+
%mean amplitudes:
7+
%If analyses are not statistically indpendent of the original mass univariate
8+
%test, results will be biased. See:
9+
%Kriegeskorte, N., Simmons, W. K., Bellgowan, P. S., & Baker, C. I. (2009).
10+
%Circular analysis in systems neuroscience: the dangers of double dipping.
11+
%Nature Neuroscience, 12(5), 535. https://doi.org/10.1038/nn.2303
912
%
1013
%EXAMPLE USAGE
1114
% >> mean_amp_data = get_mean_amplitude(GND, 2, 'effect', 'Congruency');

testing/A_setupTest.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
%AUTHOR: Eric Fields
44
%VERSION DATE: 4 March 2020
55

6+
clear all; close all; path(pathdef);
7+
68
%Add EEGLAB and MUT to path
79
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
810

0 commit comments

Comments
 (0)