Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 338 - pspm_glm #339

Merged
merged 6 commits into from
Jan 7, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/pspm_glm.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@
%__________________________________________________________________________
% PsPM 3.1
% (C) 2008-2016 Dominik R Bach (Wellcome Trust Centre for Neuroimaging)

% $Id: pspm_glm.m 627 2019-02-21 16:51:46Z lciernik $
% $Rev: 627 $

% function revision
rev = '$Rev: 627 $';
% Updated 2021 Teddy Chao

% initialise & user output
% -------------------------------------------------------------------------
Expand Down Expand Up @@ -670,7 +665,6 @@
glm.modality = model.modality;
glm.modelspec = model.modelspec;
glm.modeltype = 'glm';
glm.revision = rev;

% clear local variables --
clear iSn iMs ynew newonsets newdurations newmissing missingtimes
Expand Down Expand Up @@ -829,6 +823,18 @@
glm.regscale((end+1):(end+iSn)) = 1;

% delete missing epochs and prepare output
perc_missing = 1 - sum(glm.M)/length(glm.M);
if perc_missing >= 0.1
if sr == Xfilter.sr
warning('ID:invalid_input', ...
['More than 10% of input data was filtered out due to missing epochs. ',...
'Results may be inaccurate.']);
else
warning('ID:invalid_input', ...
['More than 10% of input data was filtered out due to missing epochs, ',...
'which is highly likely caused by downsampling. Results may be inaccurate.']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say "is possibly caused by downsampling" - the data might just as well have been missing in the first place, before downsampling.

end
end
glm.YM = glm.Y;
glm.YM(glm.M(1:length(glm.YM))==1) = [];
glm.Y(glm.M(1:length(glm.Y))==1) = NaN;
Expand Down