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] Refactor design matrix and contrast formula for the two-sample T-test example #4407
base: main
Are you sure you want to change the base?
Conversation
👋 @YCHuang0610 Thanks for creating a PR! Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft. Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.
For new features:
For bug fixes:
We will review it as quick as possible, feel free to ping us with questions if needed. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4407 +/- ##
==========================================
+ Coverage 91.85% 92.02% +0.17%
==========================================
Files 144 143 -1
Lines 16419 16635 +216
Branches 3434 3528 +94
==========================================
+ Hits 15082 15309 +227
+ Misses 792 758 -34
- Partials 545 568 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
import numpy as np | ||
|
||
condition_effect = np.hstack(([1] * n_subjects, [-1] * n_subjects)) | ||
vertical_subjects = np.hstack(([1] * n_subjects, [0] * n_subjects)) | ||
horizontal_subjects = np.hstack(([0] * n_subjects, [1] * n_subjects)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I should have been clearer, but when you do this you make the design matrix rank deficient: the sum of these two regressors, is equal to the some of all the subject regressors.
This means that the design matrix is no longer invertible, and some contrasts are not estimable. Normally, you should get a warning when you run that code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that mistake for the paired design matrix.
Now I have modified the paired design matrix as follows:
which rank is 17.
The unpaired design matrix is now added a intercept column as follows:
Its rank is 2 which is a full column rank matrix.
… full column rank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Closes #4400
Changes proposed in this pull request: