Skip to content

Commit 84a41a2

Browse files
author
Eric Fields
committed
update I_ANOVATest and put in error for unequal sample sizes for sp ANOVA
1 parent c1d1cf9 commit 84a41a2

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

perm_spANOVA.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
%This code is free and open source software made available under the 3-clause BSD license.
3939

4040
function [F_obs, F_dist, df_effect, df_res, exact_test] = perm_spANOVA(data, cond_subs, dims, n_perm, reduce)
41+
42+
if ~all(cond_subs == cond_subs(1))
43+
error('Split plot ANOVA is currently only available for designs with equal sample sizes');
44+
end
4145

4246
%Eliminate factors not involved in this effect and reduce interactions
4347
%via subtraction

testing/I_ANOVATest.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
%% RB DESIGNS PARAMETRIC ANOVA
1616

1717
%Designs to test
18-
anova_designs = {5, ...
18+
anova_designs = {2, ...
19+
5, ...
1920
[2, 2], ...
2021
[4, 2], ...
2122
[3, 4], ...
@@ -67,6 +68,7 @@
6768
oneway_data = reshape(data, n_electrodes, n_time_pts, [], n_subs);
6869
rm_data = squeeze(oneway_data(e,t,:,:))';
6970
[rm, ranovatbl] = matlab_ANOVA(rm_data, wg_design, cond_subs, var_names);
71+
%disp(ranovatbl);
7072

7173
%Calculate all effects in model and compare to MATLAB ANOVA
7274
for i = 1:length(effects)
@@ -86,7 +88,8 @@
8688
end
8789
assert(abs(test_results.p(e,t) - ranovatbl{rm_table_row, ['pValue' suff]}) < 1e-9);
8890

89-
%%% Between subjects effects
91+
%%% Group interactions %%%
92+
9093
if ~isempty(cond_subs)
9194

9295
%FMUT calculations
@@ -106,6 +109,11 @@
106109

107110
end
108111

112+
%%% Group main effect %%%
113+
114+
test_results = calc_param_ANOVA(data, cond_subs, ndims(data), 0.05, 'none', sphericity_corr);
115+
assert(abs(test_results.p(e,t) - ranovatbl{'group', ['pValue' suff]}) < 1e-9);
116+
109117
end
110118

111119

0 commit comments

Comments
 (0)