[ENH] StatsModels: Add invalid_inputs
parameter to allow dropping of missing data columns to run nodes
#1145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BIDSStatsModelsNode.run()
gracefully drops missing contrasts wheninvalid_contrasts=="drop"
, but missing data columns in the GLM at the run level (entries ofModel.X
) currently always throw an error. As far as I can tell, this makes it impossible to useBIDSStatsModelsNode
(and BIDS apps that depend on it, like fitlins) for tasks in which some conditions do not appear in some runs (a use case I happen to have at the moment, which also seems to pop up for others, e.g., here and here). This PR adds aninvalid_inputs
parameterBIDSStatsModelsNode.run()
andBIDSStatsModelsNodeOutput.__init__()
that permits a"drop"
value just likeinvalid_contrasts
, which warns about missing data columns and then removes them fromvar_names
. I've tested this modification withfitlins
and it appears to give the desired enhancement: individual runs estimate all and only the available contrasts (and missing contrasts at downstream nodes are then handled by the existinginvalid_contrasts
feature). I've set the default value ofinvalid_inputs
to"error"
, so that the previous default behavior remains unchanged.