Comments (16)
This might be a bug with pybids's resampling. My confound variable came in sparse, and was forced dense in get_design_matrix
. My guess is the resampling does its job wrong if there are n/as
. Will investigate and open issue there.
from fitlins.
Is there a consensus on what to do if you have confounds missing for some volumes?
from fitlins.
Doubt it, but replacing the with mean value seems like a reasonable solution (the "proper" BIDS model solution I discussed earlier).
Either way, I think the re-sampling function has a bug, because its returning the wrong number of volumes.
from fitlins.
You can set skip_empty=False
in pybids to keep the column around even though it's all N/As. I'm not a fan of mean imputation in this context, and I don't think it would work in any case given that adding a constant value throughout a run would be collinear with the intercept (which is presumably already included).
I think the right thing to do in this case is (a) drop the run/subject, (b) leave the confound out for that run but include it for everyone else, or (c) not include the confound in the model for anyone. I think (a) is probably the best option in most cases.
from fitlins.
Oh, but if the issue is just with a few volumes within the scan, and the n/as are occurring for sparse data, then mean imputation is probably okay. There should probably be some fairly conservative cut-off though--e.g., more than 5% missing values, and the run gets trashed.
If pybids doesn't currently have any options for ignoring n/as, feel free to open an issue for that. I don't know that mean imputation should be part of pybids though; that does feel like a transformation thing to me, even if it's kind of a pain. Otherwise we lose on the reproducibility front.
from fitlins.
It's only a single missing value in this instance (first volume). I'll open a separate issue in pybids because I think I know what the problem is
Also, pybids in some ways already has mean imputation, if you use scale
correctly.
from fitlins.
Is it just that FramewiseDisplacement is defined on the diff of two volumes, and thus is undefined either at the first or last volume? Maybe zero-filling is appropriate, instead.
from fitlins.
Ah, that makes sense, and yes we should zero fill. I guess the larger question remains: which component should handle this, and in which way (silently? by default? for which variables?)
from fitlins.
@chrisfilo Do you have an opinion here? My inclination is that this should be at the Nipype/fMRIPrep level.
from fitlins.
I think n/a
is a fair value. Zero is technically incorrect. And this issue is more general and could crop up elsewhere.
from fitlins.
There is also a fillna
argument that can be passed down from get_design_matrix
which is an option for dealing with this. The problem right now is a bug which omits the value entirely rather than returning n/a
.
from fitlins.
Now that that bug is fixed, I would vote for fitlins filling zeros in in confounds by default, but warning if it's doing so. Adding a transformation for this seems really clunky, although it would be more reproducible.
from fitlins.
Agreed, but I would do it only for FramewiseDisplacement and DVARS. Also mean of non-zero values is a better value to impute than zero.
from fitlins.
Mean is better to impute for FD and DVARS? Or 0 for the first volume of FD and DVARS, and mean of non-zeros in general for n/a
s found in other confounds?
from fitlins.
Mean is always always a better imputation value than an arbitrary constant (such as zero).
Imputing for all regressors comes with risks. I am worried about hiding issues with regressors. For FD and DVARS we are expecting this missing value to it makes sense to impute it. For other regressors I would not do imputation (at least until someone complains).
from fitlins.
Looks like right now we're always imputing 0 for all confounds:
fitlins/fitlins/interfaces/bids.py
Line 204 in 125bad9
So that needs fixing.
from fitlins.
Related Issues (20)
- Premade BIDS Database Error HOT 3
- Fetch DataLad datasets HOT 2
- Update installation instructions
- Reports fail for models with only first-level analysis
- TypeError: slice indices must be integers or None or have an __index__ method
- --drop-missing still throws errors with missing regressors HOT 2
- Support for fsnative HOT 1
- Update test and example models to stats models 1.0
- Fitlins should point to https://bids-standard.github.io/stats-models/
- How to model BIDS dataset with no trial type? HOT 1
- Handle cases where a contrast is missing from the first level HOT 4
- ReadTheDocs isn't building HOT 5
- CI: Run nightly tests with pybids@master
- Add CLI command to generate reports HOT 4
- Regressor has extra item, causing mismatch HOT 8
- TypeError: unhashable type: 'list' in Loader HOT 6
- Contrasts missing from report HOT 1
- What does fitlins assume about slice time correction? HOT 2
- Fail gracefully if no files found HOT 1
- Fail gracefully if Contrast specification is incorrect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fitlins.