'Weighted' average is not working without setting the `ExcludeNullBin' argument
filippogambarota opened this issue · 1 comments
Description
Hi! I've noticed a discrepancy between the pop_gaverager()
function and the respective function with the GUI. My guess is that the Weighted
argument is not working when used within a script. Given that the GUI is involved is difficult to write a complete reproducible example, my approach is the following:
I've created 3 .erp
files from GUI using:
- weighted
- classic without removing null bins
- classic removing null bins
Then I've created the same set but using the pop_gaverager()
Then I've compared the ERP.bindata
within GUI/script and between GUI/script
This is my approach:
%% From Script
ERP_weighted = pop_gaverager(fullfile('eeg_data', 'GA', 'ga_list.txt'), 'Weighted', 'on');
ERP_unweighted_remove = pop_gaverager(fullfile('eeg_data', 'GA', 'ga_list.txt'), 'Weighted', 'off', 'ExcludeNullBin', 'on');
ERP_unweighted_noremove = pop_gaverager(fullfile('eeg_data', 'GA', 'ga_list.txt'), 'Weighted', 'off', 'ExcludeNullBin', 'off');
isequal(ERP_weighted.bindata, ERP_unweighted_remove.bindata) % equal
isequal(ERP_unweighted_remove.bindata, ERP_unweighted_noremove.bindata) % different
%% From GUI
ERP_weighted_gui = load('ga_weighted.erp', '-mat');
ERP_weighted_gui = ERP_weighted_gui.('ERP');
ERP_unweighted_remove_gui = load('ga_unweighted_remove.erp', '-mat');
ERP_unweighted_remove_gui = ERP_unweighted_remove_gui.('ERP');
ERP_unweighted_noremove_gui = load('ga_unweighted_noremove.erp', '-mat');
ERP_unweighted_noremove_gui = ERP_unweighted_noremove_gui.('ERP');
isequal(ERP_weighted_gui.bindata, ERP_unweighted_remove_gui.bindata) % different
isequal(ERP_unweighted_remove_gui.bindata, ERP_unweighted_noremove_gui.bindata) % different
%% Compare script and GUI
isequal(ERP_weighted.bindata, ERP_weighted_gui.bindata) % different
isequal(ERP_unweighted_remove.bindata, ERP_unweighted_remove_gui.bindata) % equal
isequal(ERP_unweighted_noremove.bindata, ERP_unweighted_noremove_gui.bindata) % equal
I've commented with the isequal()
function result. Basically the weighted
, on
e off
is not effective because data are the same. I've also noticed that regardless the GUI checked options, the history command is the same across examples.
Versions
OS version | [Pop!_OS 21.04] |
Matlab version | [R2021a] |
EEGLAB version | [2021.1] |
ERPLAB version | [8.20] |
Thanks to @sbrigadoi now the issue is more clear. The Weighted
argument from the script is effective only when ExcludeNullBin
is turned off (as automatically performed in the GUI). The weighted average from GUI and ERP = pop_gaverager(ALLERP, 'Weighted', 'on', 'ExcludeNullBin', 'off')
now are the same. The problem is that omitting the ExcludeNullBin
while keeping the Weighted
argument as on, force the classic average mode but the output message still reports a weighted average.